[Asterisk-Users] Asterisk as SIP Proxy

ranga ranga at pandoranetworks.com
Mon Dec 1 00:50:53 MST 2003


Olle,

This is the complete extensions.conf. I wasnt getting the SIPDOMAIN right.
Rest of your script/configuration works only if ${SIPDOMAIN} works
Am I missing anything in this? I had the latest CVS checkout this morning,
i.e., 1st Dec. 12.00 Noon GMT +5.30.

;;;---------------------------------------------;;;;;;;;
[globals]
[macro-stdexten]
exten => s,1,Dial(${ARG1},20,tr)
exten => s,2,Ringing
exten => s,3,Answer
exten => s,4,VoiceMail2,u${MACRO_EXTEN}
exten => s,5,Hangup


;All sip users will refer to this context
[pandora]

;;These two lines I added to test if domain dialing works

exten => evaro,1,Macro(stdexten,SIP/${EXTEN}@${SIPDOMAIN})
exten => john,1,Macro(stdexten,SIP/${EXTEN}@192.168.68.6)

exten => 9001,1,Macro(stdexten,SIP/walter)
exten => 9002,1,Macro(stdexten,SIP/sridhar)
exten => 9003,1,Macro(stdexten,SIP/gopi)
exten => 9004,1,Macro(stdexten,SIP/jay)
exten => 9005,1,Macro(stdexten,SIP/ranga)
exten => 9006,1,Macro(stdexten,SIP/bharath)
;;;-----------------------------------------------------;;;;;

And the outcome is as usual. SIPDOMAIN is blank. I checked 'grep SIPDOMAIN
chan_sip.c'. I found the line
                   pbx_builtin_setvar_helper(tmp, "SIPDOMAIN", i->domain);


After this, I altered my extensions.conf like this.
;;;;;;;;;;;;;;------------------------------;;;;;;;;;;;;;;;;;;;;

[globals]
MYCURRENTDOMAIN=192.168.68.15

[macro-stdexten]
exten => s,1,Dial(${ARG1},20,tr)
exten => s,2,Ringing
exten => s,3,Answer
exten => s,4,VoiceMail2,u${MACRO_EXTEN}
exten => s,5,Hangup


;All sip users will refer to this context
[pandora]

exten => 9001,1,Macro(stdexten,SIP/walter)
exten => 9002,1,Macro(stdexten,SIP/sridhar)
exten => 9003,1,Macro(stdexten,SIP/gopi)
exten => 9004,1,Macro(stdexten,SIP/jay)
exten => 9005,1,Macro(stdexten,SIP/ranga)
exten => 9006,1,Macro(stdexten,SIP/bharath)

exten =>_.,1,SetGlobalVar(sipto=${EXTEN})
exten =>_.,2,SetGlobalVar(sipdom=${SIPDOMAIN})
;Every extension will go here, including h, t, s
;Filter out hangups
exten =>_.,3,gotoif,$[${sipto} = h]?30|1:5|1

;---Test if external dial - on domain name
exten =>5,1,gotoif($[${SIPDOMAIN} = ${MYCURRENTDOMAIN}]?20,1:10,1)

exten =>10,1,Dial(SIP/${sipto}@${sipdom})
exten =>10,2,Hangup

exten =>20,1,Goto(${sipto},1)
exten => 30,1,Hangup


;;;;;;;;;;;;;;;;;----------------------------------------------;;;;;;;;;
And here is the console capture

    -- Got SIP response 481 "Subscription does not exist" back from
192.168.68.12
    -- Executing SetGlobalVar("SIP/sridhar-2364", "sipto=evaro") in new
stack
    -- Setting global variable 'sipto' to 'evaro'
    -- Executing SetGlobalVar("SIP/sridhar-2364", "sipdom=") in new stack
    -- Setting global variable 'sipdom' to ''
    -- Executing GotoIf("SIP/sridhar-2364", "0?30|1:5|1") in new stack
    -- Goto (pandora,5,1)
WARNING[1217603008]: File ast_expr.y, Line 346 (ast_yyerror): ast_yyerror():
syntax error: parse error
    -- Executing GotoIf("SIP/sridhar-2364", "0?20|1:10|1") in new stack
    -- Goto (pandora,10,1)
    -- Executing Dial("SIP/sridhar-2364", "SIP/evaro@") in new stack
WARNING[1217603008]: File chan_sip.c, Line 749 (create_addr): No such host:
NOTICE[1217603008]: File app_dial.c, Line 516 (dial_exec): Unable to create
channel of type 'SIP'
  == Everyone is busy at this time
    -- Executing Hangup("SIP/sridhar-2364", "") in new stack
  == Spawn extension (pandora, 10, 2) exited non-zero on 'SIP/sridhar-2364'
    -- Executing SetGlobalVar("SIP/sridhar-2364", "sipto=h") in new stack
    -- Setting global variable 'sipto' to 'h'
    -- Executing SetGlobalVar("SIP/sridhar-2364", "sipdom=") in new stack
    -- Setting global variable 'sipdom' to ''
    -- Executing GotoIf("SIP/sridhar-2364", "1?30|1:5|1") in new stack
    -- Goto (pandora,30,1)
    -- Executing Hangup("SIP/sridhar-2364", "") in new stack
  == Spawn extension (pandora, 30, 1) exited non-zero on 'SIP/sridhar-2364'


thanks and regards
-Ranga

----- Original Message -----
From: "Olle E. Johansson" <oej at edvina.net>
To: <asterisk-users at lists.digium.com>
Sent: Saturday, November 29, 2003 11:53 PM
Subject: Re: [Asterisk-Users] Asterisk as SIP Proxy


> You need to check the SIPDOMAIN early in the outgoing sip context for the
> callee. I don't know your context here.
> Also, please make sure you have an new CVS checkout, I don't know which
version
> you're running. Run 'grep SIPDOMAIN' in chan_sip.c to make sure it's
there.
>
> Here's what I do early in thte outgoing SIP context for clients:
>
> ;------------------------OUTGOING CALLS FROM SIP-------------------------
> [sip-callers]
>
> ;----Match everything
> exten =>_.,1,SetGlobalVar(sipto=${EXTEN})
> exten =>_.,2,SetGlobalVar(sipdom=${SIPDOMAIN})
> ;Every extension will go here, including h, t, s
> ;Filter out hangups
> exten =>_.,3,gotoif,$[${sipto} = h]?30|1:5|1
>
> ;---Test if external dial - on domain name
> exten =>5,1,gotoif($[${SIPDOMAIN} = ${MYCURRENTDOMAIN}]?20,1:10,1)
>
;--------------------------------------------------------------------------
>
> MYCURRENTDOMAIN is set early in extensions.conf to the servers SIP realm.
>
> /Olle
>
> _______________________________________________
> Asterisk-Users mailing list
> Asterisk-Users at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-users
>
>





More information about the asterisk-users mailing list