[Asterisk-Users] SIP extension

Frederic Steinfels fredo at dvdupgrades.ch
Wed Oct 6 09:36:22 MST 2004


Mike Heininger wrote:

> Hi,
>
> my VoIP provider routes my main phone number and all extensions to 
> the  same sip account.
> In the sip header of the invite message is the To: field that shows 
> me  which extension the caller dialed ...
>
> for extension 0:
> INVITE sip:2 at ip_of_sipserver SIP/2.0
> [...]
> To: sip:00431234567890 at ip_of_sip_provider
>
> for extension 10:
> To: sip:004312345678910 at ip_of_sip_provider
>
> How can I use this extension information in my dialplan?
> I have tried ${RDNIS}  
> (http://lists.digium.com/pipermail/asterisk-users/2004-March/ 
> 041264.html) but this doesn´t work (RDNIS is empty).
>
> I use CVS-HEAD-05/22/04
>
>

The purpose of my application is this:
- when transfering a call blindly/unattended to an extension
- dial back to the transferer if the extension in question does not pick 
up within 10secs or is busy
- if the call is not picked up there either, send it to a queue

As is my understanding, I will have to use RDNIS in oder to send back 
the call if the desired extension is not available.

Unfortunately RDNIS is always blank so I was able to use DNID, 
unfortunately this is only working for local calls or in other words if 
the person that was called was directly/uniquely called by a Dial 
command and not by a queue. I also had to put in a few quirks in order 
to allow both ends of the calls to be correctly transfered and bounced 
back (all possiblities are covered on local direct calls). As RDNIS is 
still and always empty for me as well (I am using Asterisk 
CVS-HEAD-08/13/04-12:00:00-BRI-stuffed-0.1.0-RC4a), I can not solve my 
issues with calls originating externally.


DNID contains the CALLERID of the "picked up by local phone" at the 
"forwarding to another lcoal phone" event BUT ONLY if

  local caller calling =>picked up by local phone => forwarding to 
another local phone

RDNIS is empty when/though DNID is working



DNID and RDNIS are empty if

external iax2 caller => picked up by local phone => forwarding to 
another  local phone




my forwarding context (set with TRANSFER_CONTEXT when the call was 
created in order to make sure THIS context is taken)

exten => _1X,1,GotoIf($[${LEN(${TRANSFER_CONTEXT})} = 0]?2:5)
exten => _1X,2,Macro(channel,${CALLERIDNUM},${CHANNEL})
exten => _1X,3,SetVar(CALLINGCHANNEL=${MYCHANNEL})
exten => _1X,4,Goto(7)
exten => _1X,5,Macro(channel,${DNID},${CHANNEL})
exten => _1X,6,SetVar(CALLINGCHANNEL=${MYCHANNEL})
exten => _1X,7,Macro(channel,${EXTEN},${CHANNEL})
exten => _1X,8,SetVar(CALLEDCHANNEL=${MYCHANNEL})
exten => _1X,9,NoOp,"CALLINGCHANNEL"
exten => _1X,10,NoOp,${CALLINGCHANNEL}
exten => _1X,11,NoOp,"CALLEDCHANNEL"
exten => _1X,12,NoOp,${CALLEDCHANNEL}
exten => _1X,13,NoOp,"TRANSFER_CONTEXT"
exten => _1X,14,NoOp(${LEN(${TRANSFER_CONTEXT})})
exten => _1X,15,NoOp,${TRANSFER_CONTEXT}
exten => _1X,16,NoOp,"RDNIS "
exten => _1X,17,NoOp,${RDNIS}
exten => _1X,18,NoOp,"DNID"
exten => _1X,19,NoOp,${DNID}
exten => _1X,20,NoOp,"EXTEN"
exten => _1X,21,NoOp,${EXTEN}
exten => _1X,22,SetVar(TRANSFER_CONTEXT=transfering)
exten => _1X,23,Dial(${CALLEDCHANNEL},10,tTm)
exten => _1X,24,Dial(${CALLEDCHANNEL}&${CALLINGCHANNEL},15,tTm)
exten => _1X,25,Queue(all-q|t)
exten => _1X,26,Hangup
exten => _1X,123,Goto(50)
exten => _1X,124,Goto(25)
exten => _1X,50,Wait(8)
exten => _1X,51,Goto(24)


[macro-channel]
exten => s,1,SetVar(MYCHANNEL=${ARG2})
exten => s,2,GotoIf($[${ARG1} = 11]?3:4)
exten => s,3,SetVar(MYCHANNEL=Zap/g3/11)
exten => s,4,GotoIf($[${ARG1} = 12]?5:6)
exten => s,5,SetVar(MYCHANNEL=Zap/g3/12)
exten => s,6,GotoIf($[${ARG1} = 13]?7:8)
exten => s,7,SetVar(MYCHANNEL=Sip/gs1 at gs1)
exten => s,8,GotoIf($[${ARG1} = 14]?9:10)
exten => s,9,SetVar(MYCHANNEL=Sip/gs2 at gs2)
exten => s,10,GotoIf($[${ARG1} = 17]?11:12)
exten => s,11,SetVar(MYCHANNEL=Sip/cisco1 at cisco1)
exten => s,12,NoOp,${MYCHANNEL}





debug on local calls

    -- Executing NoOp("Zap/8-1", "CALLINGCHANNEL") in new stack
    -- Executing NoOp("Zap/8-1", "Sip/gs1 at gs1") in new stack
    -- Executing NoOp("Zap/8-1", "CALLEDCHANNEL") in new stack
    -- Executing NoOp("Zap/8-1", "Zap/g3/11") in new stack
    -- Executing NoOp("Zap/8-1", "TRANSFER_CONTEXT") in new stack
    -- Executing NoOp("Zap/8-1", "11") in new stack
    -- Executing NoOp("Zap/8-1", "transfering") in new stack
    -- Executing NoOp("Zap/8-1", "RDNIS ") in new stack
    -- Executing NoOp("Zap/8-1", "") in new stack
    -- Executing NoOp("Zap/8-1", "DNID") in new stack
    -- Executing NoOp("Zap/8-1", "13") in new stack
    -- Executing NoOp("Zap/8-1", "EXTEN") in new stack
    -- Executing NoOp("Zap/8-1", "11") in new stack


debug on external calls

    -- Executing NoOp("IAX2/0435440706 at 0435440706/5", "CALLINGCHANNEL") 
in new stack
    -- Executing NoOp("IAX2/0435440706 at 0435440706/5", 
"IAX2/0435440706 at 0435440706/5") in new stack
    -- Executing NoOp("IAX2/0435440706 at 0435440706/5", "CALLEDCHANNEL") 
in new stack
    -- Executing NoOp("IAX2/0435440706 at 0435440706/5", "Zap/g3/12") in 
new stack
    -- Executing NoOp("IAX2/0435440706 at 0435440706/5", 
"TRANSFER_CONTEXT") in new stack
    -- Executing NoOp("IAX2/0435440706 at 0435440706/5", "11") in new stack
    -- Executing NoOp("IAX2/0435440706 at 0435440706/5", "transfering") in 
new stack
    -- Executing NoOp("IAX2/0435440706 at 0435440706/5", "RDNIS ") in new stack
    -- Executing NoOp("IAX2/0435440706 at 0435440706/5", "") in new stack
    -- Executing NoOp("IAX2/0435440706 at 0435440706/5", "DNID") in new stack
    -- Executing NoOp("IAX2/0435440706 at 0435440706/5", "") in new stack
    -- Executing NoOp("IAX2/0435440706 at 0435440706/5", "EXTEN") in new stack
    -- Executing NoOp("IAX2/0435440706 at 0435440706/5", "12") in new stack




More information about the asterisk-users mailing list