FreePBX/Asterisk 14
Hello,
We have an Avaya and Asterisk PBX set. Calls start and end (reaching an endpoint) in Avaya. In between the start and end, calls route out to Asterisk for various treatments (callbacks, IVRs, etc.). When the call begins in Avaya, a unique ID is (UCID) is created for the call. This unique ID is sent via SIP header to Asterisk as the call routes. I am able to pull the Avaya UCID into a variable with:
exten => s,n,Set(UUI=${SIP_HEADER(User-To-User)})
My problem is getting this $UUI back into the SIP header when I get ready to route back to Avaya. I am using this combo to send the call back to Avaya:
exten => s,n,SIPAddHeader(User-To-User: ${UUI})
exten => s,n,Goto(from-internal,${ROUTECBAYES},1)
When the call comes back into Avaya the UUI SIP header is not present, so Avaya creates a new UCID, breaking the continuity of the call. I am thinking this is because I am not inserting the add SIP header line in the correct place.
When I use: exten => s,n,Goto(from-internal,
I notice there is a function that gets called: func-apply-sipheaders
Dial("SIP/xxxxxxxxxxxx", "SIP/xxxxxx/yyyyyyy,300,Tb(func-apply-sipheaders^s^1,(1))") in new stack
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
-- SIP/xxxxxxxxxxxx Internal Gosub(func-apply-sipheaders,s,1(1)) start
Executing [s@func-apply-sipheaders:1] ExecIf("SIP/xxxxxxxxxxxx ", "1?Set(CHANNEL(hangup_handler_push)=crm-hangup,s,1)") in new stack
-- Executing [s@func-apply-sipheaders:2] NoOp("SIP/xxxxxxxxxxxx ", "Applying SIP Headers to channel SIP/xxxxxxxxxxxx ") in new stack
-- Executing [s@func-apply-sipheaders:3] Set("SIP/xxxxxxxxxxxx ", "TECH=SIP") in new stack
-- Executing [s@func-apply-sipheaders:4] Set("SIP/xxxxxxxxxxxx ", "SIPHEADERKEYS=") in new stack
-- Executing [s@func-apply-sipheaders:5] While("SIP/xxxxxxxxxxxx ", "0") in new stack
-- Jumping to priority 12
-- Executing [s@func-apply-sipheaders:13] Return("SIP/xxxxxxxxxxxx ", "") in new stack
Question:
-
Where do I need to insert my SIPAddHeader(User-To-User: ${UUI}) command? Into func-apply-sipheaders?
-
If yes, how do I do it? I know you can rewrite things in the override file and include the original, but it would be nice if there was an example to follow.
-
In the case that I am completely down the wrong path here, what do you recommend for adding a User to User SIP header to the call before dialing?
Thanks in advance for any insights!