Skip to main content

Posts

Showing posts from November, 2024

BSNL Incoming DID Dialplan

  [from-trunk] ; Try to capture DID if provided directly exten => _X.,1,NoOp(Incoming call with DID: ${EXTEN} and Caller ID: ${CALLERID(num)})  same => n,Set(realDID=${EXTEN})  same => n,Set(CALLERID_INFO=${CALLERID(num)})  same => n,NoOp(Direct DID: ${realDID}, Caller ID: ${CALLERID_INFO})  same => n,Dial(SIP/GATEWAY/${EXTEN})  same => n,Hangup() ; Fallback if no DID is provided (calls to 's' extension) exten => s,1,NoOp(Fallback - No DID provided, attempting header extraction)  same => n,Set(CALLERID_INFO=${CALLERID(num)})  ; Extract the DID from the To header and strip any additional information  same => n,Set(PJSIP_HEADER=${SIP_HEADER(To)})  same => n,Set(realDID=${CUT(CUT(PJSIP_HEADER,@,1),:,2)})  same => n,ExecIf($["${realDID}" = ""]?Set(realDID=UNKNOWN))  same => n,NoOp(Extracted DID: ${realDID}, Caller ID: ${CALLERID_INFO})  same => n,Dial(SIP/GATEWAY/${realDID})  same => n,Hangup() [GATEWAY] exten => _X.,