[asterisk-users] Custom dial plan for internal transfers of external calls

James B. Byrne byrnejb at harte-lyne.ca
Wed Jul 3 13:24:40 CDT 2013


Arch = x86_64
OS = CentOS-6.4 (freepbx)
Asterisk = 11.4.0
FreePBX = 2.11.0.2

We use Snom870 handsets with firmware v.8.7.3.19.

I am trying to develop a custom dial plan to invoke a distinctive
ring-tone when an external call is transferred internally.  Based on
an earlier solution I discovered I am attempting this:

[from-internal]
include => set-alert-if-local

[from-internal-original]
include => from-internal-xfer
include => bad-number

[set-alert-if-local]
.  . .
exten => _417XX,n,GotoIf($["${CALLERID(num)}" >
"SIP/41799"]?notfromlocal)
exten => _417XX,n,GotoIf($["${CALLERID(num)}" <
"SIP/41710"]?notfromlocal)
;If we reach here then the caller is within the upper and lower bounds
exten => _417XX,n,Set(__ALERT_INFO=${AlertSnom}${AlertInternalTransfer})
exten => _417XX,n(notfromlocal),Goto(from-internal-original,${EXTEN},1)
;The following three lines must not be changed!
exten => _.,1,Goto(from-internal-original,${EXTEN},1)
exten => s,1,Goto(from-internal-original,s,1)
exten => h,1,Macro(hangupcall)


This context appears to be entered only when the call originates from
another extension.  When a transfer of an external call is attempted
theis context does not seem to be entered.

The following abstracted asterisk trace log shows this for an incoming
call answered on 41712 and then transferred to 41720.

    -- SIP/41711-00000165 is ringing
    -- SIP/41713-00000167 is ringing
    -- SIP/41712-00000166 is ringing
    -- SIP/41720-00000169 is ringing
    -- SIP/41718-00000168 is ringing

  == Extension Changed 41712[ext-local] new state InUse for Notify
User 41710
  == Extension Changed 41712[ext-local] new state InUse for Notify
User 41711
    -- SIP/41712-00000166 connected line has changed. Saving it until
answer for DAHDI/1-1
    -- SIP/41712-00000166 answered DAHDI/1-1
  == Extension Changed 41712[ext-local] new state InUse for Notify
User 41715
  == Extension Changed 41712[ext-local] new state InUse for Notify
User 41717
  == Extension Changed 41712[ext-local] new state InUse for Notify
User 41718
    -- Executing [s at macro-auto-blkvm:1] Set("SIP/41712-00000166",
"__MACRO_RESULT=") in new stack
    -- Executing [s at macro-auto-blkvm:2] Macro("SIP/41712-00000166",
"blkvm-clr,") in new stack

At this point the original incoming call is answered.

.  .  .
    -- Executing [s at macro-auto-blkvm:3] ExecIf("SIP/41712-00000166",
"0?Set(MASTER_CHANNEL(CONNECTEDLINE(num))=41712)") in new stack

And then transferred to 41720

[2013-07-03 13:43:03] WARNING[7954][C-00004685]: res_srtp.c:406
ast_srtp_unprotect: SRTP unprotect failed with: authentication failure
110
    -- Stopped music on hold on DAHDI/1-1
  == Extension Changed 41712[ext-local] new state Idle for Notify User
41710
  == Extension Changed 41712[ext-local] new state Idle for Notify User
41711
  == Extension Changed 41712[ext-local] new state Idle for Notify User
41715
  == Spawn extension (from-internal-xfer, 41720, 1) exited non-zero on
'DAHDI/1-1' in macro 'dial'
  == Spawn extension (from-internal-xfer, 41720, 1) exited non-zero on
'DAHDI/1-1'
    -- Executing [41720 at from-internal-xfer:1] Set("DAHDI/1-1",
"__RINGTIMER=20") in new stack

And finally answered on 41720

[2013-07-03 13:43:16] DEBUG[29747][C-00004685]: sip/sdp_crypto.c:310
sdp_crypto_offer: Crypto line: a=crypto:1 AES_CM_128_HMAC_SHA1_80
inline:5D038u88tI6PLyruDovyQIku9PH7exEAL3Qolc9m
  == Extension Changed 41720[ext-local] new state InUse for Notify
User 41711
  == Extension Changed 41720[ext-local] new state InUse for Notify
User 41715
    -- SIP/41720-0000016a answered DAHDI/1-1

It is evident from the trace that the context [set-alert-if-local] is
not entered on internal transfers and I lack the experience to
understand why.  Can someone here enlighten me as to what is going on
in this instance and how I should change my contexts in order to check
for internal transfers of external calls?

-- 
***          E-Mail is NOT a SECURE channel          ***
James B. Byrne                mailto:ByrneJB at Harte-Lyne.ca
Harte & Lyne Limited          http://www.harte-lyne.ca
9 Brockley Drive              vox: +1 905 561 1241
Hamilton, Ontario             fax: +1 905 561 0757
Canada  L8E 3C3




More information about the asterisk-users mailing list