Hi all. First of all, I’m comfortable with stock asterisk using it since 1.2 but not with FreePBX.
I want to check how I could add my dialplan rules for various scenario. So I try to add my own PJSIP_HEADERS and saw that I could do it in macro-dial-one just before the dial. I also add a channel variable for incoming calls from trunk, which is called DIALEDNUMBER. In macro-dial-one I set
exten => s,n,ExecIf($[“${ivrreturn}” = “1”]?Set(D_OPTIONS=${D_OPTIONS}g))
same = n,NoOp(DIALEDNUMBER=${DIALEDNUMBER})
same = n,ExecIf($[“x${DIALEDNUMBER:-4}” = “x0089”]?Gosub(func-set-sipheader,s,1(Alert-Info,blabla;info=Private-DH;x-line-id=0)))
exten => s,n(dial),Dial(${DSTRING},${ARG1},${D_OPTIONS}${CWRING}b(func-apply-sipheaders^s^1))
With result being
-- Executing [[email protected]:55] ExecIf("Local/[email protected];2", "0?Set(D_OPTIONS=HhTtrM(auto-blkvm)g)") in new stack
-- Executing [[email protected]:56] NoOp("Local/[email protected];2", "DIALEDNUMBER=XXXXXX0089") in new stack
-- Executing [[email protected]:57] ExecIf("Local/[email protected];2", "1?Gosub(func-set-sipheader,s,1(Alert-Info,blabla;info=Private-DH;x-line-id=0))") in new stack
== Channel ‘Local/[email protected];2’ jumping out of macro ‘dial-one’
== Channel ‘Local/[email protected];2’ jumping out of macro ‘exten-vm’
– Executing [[email protected]:1] NoOp(“Local/[email protected];2”, “Sip Add Header function called. Adding = HhTtrM(auto-blkvm)”) in new stack
– Executing [[email protected]:2] Set(“Local/[email protected];2”, “HASH(__SIPHEADERS,)=HhTtrM(auto-blkvm)”) in new stack
– Executing [[email protected]:3] Return(“Local/[email protected];2”, “”) in new stack
So jumping out of queue twice and adding Sip Header HhTtrM(auto-blkvm) !!!
Now I remove the ExecIf($[“x${DIALEDNUMBER:-4}” = “x0089”]? which now looks like
same = n,Gosub(func-set-sipheader,s,1(Alert-Info,blabla;info=Private-DH;x-line-id=0))
and get
-- Executing [[email protected]:55] ExecIf("Local/[email protected];2", "0?Set(D_OPTIONS=HhTtrM(auto-blkvm)g)") in new stack
-- Executing [[email protected]:56] NoOp("Local/[email protected];2", "DIALEDNUMBER=XXXXXX0089") in new stack
-- Executing [[email protected]:57] Gosub("Local/[email protected];2", "func-set-sipheader,s,1(Alert-Info,blabla;info=Private-DH;x-line-id=0)") in new stack
-- Executing [[email protected]:1] NoOp("Local/[email protected];2", "Sip Add Header function called. Adding Alert-Info = blabla;info=Private-DH;x-line-id=0") in new stack
which is the right result.
Anyone has an idea on this ? Should I open an issue ?
Daniel