-- Executing [2@a-service:3] ExecIf("PJSIP/Provider_SIP_Trunk-00000007", "1?Dial(PJSIP/0547779947@Provider_SIP_Trunk,,b(outgoing-call^headerchange^1))") in new stack
-- PJSIP/Provider_SIP_Trunk-00000008 Internal Gosub(outgoing-call,headerchange,1) start
-- Executing [headerchange@outgoing-call:1] Set("PJSIP/Provider_SIP_Trunk-00000008", "PJSIP_HEADER(add,Diversion)=<sip:[email protected]:5060>;privacy=off;screen=no;reason=unconditional") in new stack
[2017-05-20 13:56:25] NOTICE[25350][C-00000004]: app_stack.c:1082 gosub_run: PJSIP/Provider_SIP_Trunk-00000008 Abnormal 'Gosub(outgoing-call,headerchange,1)' exit. Popping routine return locations.
-- Called PJSIP/0547779947@Provider_SIP_Trunk
-- PJSIP/Provider_SIP_Trunk-00000008 is ringing
-- PJSIP/Provider_SIP_Trunk-00000008 answered PJSIP/Provider_SIP_Trunk-00000007
-- Channel PJSIP/Provider_SIP_Trunk-00000008 joined 'simple_bridge' basic-bridge <d6a2f00f-1a47-4068-9c9d-1763d614c36f>
-- Channel PJSIP/Provider_SIP_Trunk-00000007 joined 'simple_bridge' basic-bridge <d6a2f00f-1a47-4068-9c9d-1763d614c36f>
-- Channel PJSIP/Provider_SIP_Trunk-00000007 left 'simple_bridge' basic-bridge <d6a2f00f-1a47-4068-9c9d-1763d614c36f>
-- Channel PJSIP/Provider_SIP_Trunk-00000008 left 'simple_bridge' basic-bridge <d6a2f00f-1a47-4068-9c9d-1763d614c36f>
== Spawn extension (a-service, 2, 3) exited non-zero on 'PJSIP/Provider_SIP_Trunk-00000007'
the problem is that the Diversion is not added or updated, the trace contains different diversion.
the added diversion is the one from the other channel of the incoming call before the dial command was executed.
can you please assist to create a new diversion for outgoing call?
The “Popping routine return location” message is telling you that your subroutine is missing a Return statement.
Not an expert on PJSIP_HEADER function, but it is possible that that ‘add’ action will not overwrite an existing header, only add a new one. Try using ‘update’ or ‘remove’ then ‘add’.
Hello,
another update - I tried to remove the diversion first and then to add it, but still have the problem, the original diversion from the incoming call is still exists.
Hello,
another update…
I tried to add a new field - “TestField” with “testvalue” this works, seems that the function is working, but probably something else is overwrite the diversion.