Dialplan - modify OUTBOUND_CNUM

Hi
can you help me someone ?
I need to modify OUTBOUND_CNUM before send to trunk.
A need to add + character if missing.
I try to custom “use macro-dialout-trunk-predial-hook” but unsuccessful

Thx

Please provide the contents of your custom context and the Asterisk logs of its execution.

My test

[macro-dialout-trunk-predial-hook]
exten => s,1,NoOp(22BBK Checking if OUTBOUND_CNUM starts with ‘+’)
exten => s,n,NoOp(22BBK modifikacia TRUNKU num=: ${CALLERID(num)})
exten => s,n,NoOp(22BBK modifikacia TRUNKU all=: ${CALLERID(all)} )
exten => s,n,NoOp(22BBK modifikacia TRUNKU name=: ${CALLERID(name)})
exten => s,n,NoOp(22BBK modifikacia TRUNKU ani=: ${CALLERID(ani)})
exten => s,n,NoOp(22BBK before bbkkk OUTBOUND_CNUM= ${OUTBOUND_CNUM})
exten => s,n,ExecIf($[“${OUTBOUND_CNUM:0:1}” != “+”]?Set(OUTBOUND_CNUM=+${CALLERID(num)}))
exten => s,n,NoOp(22BBK Updated OUTBOUND_CNUM is now: ${OUTBOUND_CNUM})
exten => s,n,MacroExit()

log:
Executing [s@macro-dialout-trunk:32] NoOp(“PJSIP/BENESTRA1-0000027f”, “Dial failed for some reason with DIALSTATUS = CHANUNAVAIL and HANGUPCAUSE = 21”) in new stack

SIP - provider not accept my number format + character is missing

I said the log of its execution.

My guess is that OUTBOUND_CNUM is a dead variable at that point and the final value has already been set in CALLERID(num), but verifying that means trawling through source code, or finding a suitable log. As the problem might be something else, having your logs is best.

This.

By the time the dialplan hook is called, all the CID rules are processed and OUTBOUND_CNUM is irrelevant. You will need to change the CALLERID(number) directly to change it for an outbound call.

I fix it
my problem was diversion, wrong SIP header.

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