CRM Link (Webhooks) - Trigger When an Extension Rings (and send destination) - Partial Solution

I’ve been experimenting with the CRM Link module and it seems to do 90% of what I need for a custom integration with our other systems (both CRM and otherwise!). A webhook is sent on the START of a call and the END (hangup).

As per this thread - CRM module (webhooks) no destination on inbound calls - currently, the “destination” is not sent until the END (hangup). Part of my goal is to enable user-specific actions when their extensions ring (send IM message, mute music, whatever they like…).

I have a custom tweak that gets me most of the way there. I added this to extensions_custom.conf

[macro-dialout-one-predial-hook]
exten => s,1,Noop(Trigger CRM Link on extension ringing)
exten => s,n,Set(__CRM_DESTINATION=${EXTTOCALL})
exten => s,n,AGI(sangomacrm.agi)
exten => s,n,MacroExit

That causes another webhook call to be triggered when an extension rings, inheriting the __CRM variables that were previously set. Unfortunately, it seems that the encrypted code in “/var/www/html/admin/modules/sangomacrm/importOne.php” refuses to pass the “destination” variable to the webhook unless __CRM_DIRECTION=OUTBOUND or __CRM_HANGUP=1.

So close! Any chance that there is a way to get this changed so that if a destination is present, it is passed, regardless of the DIRECTION or whether the call is being hung up?

Not what you are asking, but is there anyway to make an inherited variable yourself, earlier in the call? Then you can call the adhoc variable to finish off your dialplan?

Thanks for the suggestion @comtech, appreciate your time. I might be missing something but I don’t think that will solve my issue as the webhook call is made during the encrypted AGI script and this is where the variable is not passed on. The ideal would be if the Sangoma guys could tweak the script so that it WILL pass the destination IF the variable is set

I think the workarounds (using CRM Link) are:

  1. Append the destination to the source (pipe separated or whatever) and expect this weird format in my webhook endpoint.
  2. Set the direction to OUTBOUND even though it is INBOUND.
  3. Set the HANGUP variable to 1, even though it isn’t a hangup.

Or outside of the CRM Link module.

  1. Just make a Curl call from the dialplan and forget the CRM Link module altogether.
  2. Make a call to CID Superfecta and use its “call to URL” function.

It just seems a shame as the CRM Link module is already setup to do what I need, almost!

The only other thing I can think is that maybe the Sangoma guys can point me in the direction of appropriating whatever the CRM Link does for the Zulu Call Pop as I’d imagine it sends some kind of webhook call to Zulu when the call is passed to an extension… no idea though as I can’t see inside the encrypted code to check!

Gotcha. Well if its not a bug, they would likely need a feature request to proceed.

https://wiki.freepbx.org/display/SUP/How+to+open+a+Feature+Request

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.