[Freeswitch-users] unexpectedly dial through gateway

Zhuravlov Sergey orbit at klbank.ru
Tue Dec 20 12:03:17 MSK 2011


Thank you! 
I was delighted and thought, as I did not think to myself! Indeed
found earlier definition of gateways, fixed regexp.

However, I realized that the call is routed through the gateway, which I only
use for incoming calls, outgoing is no any rules or regexps, which would allow
the call to go through it.

Mystery!

And most importantly, that when turned off via the CLI this particular gateway
- everything works as expected. Just turn on again the call goes through it for
some reason!

Maybe you can somehow increase the debug level for routing?

yy.yyy.yy.yy -- FS
xx.xxx.xx.xx -- Asterisk

Example call 1 - gateway with problem is off - the call goes as it should


EXECUTE sofia/internal/271 at intra.mydom.com hash(insert/intra.mydom.com-last_dial/271/711)
EXECUTE sofia/internal/271 at intra.mydom.com hash(insert/intra.mydom.com-last_dial/global/042c1036-2a81-11e1-9963-ab2ff8b5cdf8)
EXECUTE sofia/internal/271 at intra.mydom.com set(RFC2822_DATE=Mon, 19 Dec 2011 22:35:40 +0200)
2011-12-19 22:35:40.694311 [DEBUG] mod_dptools.c:1063 sofia/internal/271 at intra.mydom.com SET [RFC2822_DATE]=[Mon, 19 Dec 2011 2
2:35:40 +0200]
EXECUTE sofia/internal/271 at intra.mydom.com set(hangup_after_bridge=true)
2011-12-19 22:35:40.694311 [DEBUG] mod_dptools.c:1063 sofia/internal/271 at intra.mydom.com SET [hangup_after_bridge]=[true]
EXECUTE sofia/internal/271 at intra.mydom.com bridge(sofia/external/711 at xx.xxx.xx.xx)
2011-12-19 22:35:40.694311 [DEBUG] switch_ivr_originate.c:1869 Parsing global variables
2011-12-19 22:35:40.694311 [NOTICE] switch_channel.c:816 New Channel sofia/external/711 at xx.xxx.xx.xx [042d9b5e-2a81-11e1-9964-a
b2ff8b5cdf8]
2011-12-19 22:35:40.694311 [DEBUG] mod_sofia.c:4311 (sofia/external/711 at xx.xxx.xx.xx) State Change CS_NEW -> CS_INIT
2011-12-19 22:35:40.694311 [DEBUG] switch_core_session.c:1114 Send signal sofia/external/711 at xx.xxx.xx.xx [BREAK]
2011-12-19 22:35:40.694311 [DEBUG] switch_core_state_machine.c:325 (sofia/external/711 at xx.xxx.xx.xx) Running State Change CS_IN
IT
2011-12-19 22:35:40.694311 [DEBUG] switch_core_state_machine.c:361 (sofia/external/711 at xx.xxx.xx.xx) State INIT
2011-12-19 22:35:40.694311 [DEBUG] mod_sofia.c:85 sofia/external/711 at xx.xxx.xx.xx SOFIA INIT
send 983 bytes to udp/[xx.xxx.xx.xx]:5060 at 20:35:40.708576:
   ------------------------------------------------------------------------
   INVITE sip:711 at xx.xxx.xx.xx SIP/2.0
   Via: SIP/2.0/UDP yy.yyy.yy.yy:5080;rport;branch=z9hG4bKF00gejSj294yr
   Max-Forwards: 69
   From: "NTCOM" <sip:271 at yy.yyy.yy.yy>;tag=tt3ev7SFNK53e
   To: <sip:711 at xx.xxx.xx.xx>
   Call-ID: db8c0ed3-a523-122f-b690-bf4d9e35213b
   CSeq: 21827406 INVITE
   Contact: <sip:mod_sofia at yy.yyy.yy.yy:5080>
   User-Agent: FreeSWITCH-mod_sofia/1.0.head-git-4480abc 2011-05-27 21-46-28 -0500
   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, UPDATE, INFO, REGISTER, REFER, NOTIFY
   Supported: timer, precondition, path, replaces
   Allow-Events: talk, hold, refer
   Content-Type: application/sdp




Example Call 2 - Gateway is turned on and the call goes through it -- it's
WRONG


EXECUTE sofia/internal/271 at intra.mydom.com hash(insert/intra.mydom.com-last_dial/271/711)
EXECUTE sofia/internal/271 at intra.mydom.com hash(insert/intra.mydom.com-last_dial/global/b27a7a7e-2a81-11e1-99a5-ab2ff8b5cdf8)
EXECUTE sofia/internal/271 at intra.mydom.com set(RFC2822_DATE=Mon, 19 Dec 2011 22:40:33 +0200)
2011-12-19 22:40:33.136251 [DEBUG] mod_dptools.c:1063 sofia/internal/271 at intra.mydom.com SET [RFC2822_DATE]=[Mon, 19 Dec 2011 2
2:40:33 +0200]
EXECUTE sofia/internal/271 at intra.mydom.com set(hangup_after_bridge=true)
2011-12-19 22:40:33.136251 [DEBUG] mod_dptools.c:1063 sofia/internal/271 at intra.mydom.com SET [hangup_after_bridge]=[true]
EXECUTE sofia/internal/271 at intra.mydom.com bridge(sofia/external/711 at xx.xxx.xx.xx)
2011-12-19 22:40:33.136251 [DEBUG] switch_ivr_originate.c:1869 Parsing global variables
2011-12-19 22:40:33.136251 [NOTICE] switch_channel.c:816 New Channel sofia/external/711 at xx.xxx.xx.xx [b27bc0dc-2a81-11e1-99a6-a
b2ff8b5cdf8]
2011-12-19 22:40:33.136251 [DEBUG] mod_sofia.c:4311 (sofia/external/711 at xx.xxx.xx.xx) State Change CS_NEW -> CS_INIT
2011-12-19 22:40:33.136251 [DEBUG] switch_core_session.c:1114 Send signal sofia/external/711 at xx.xxx.xx.xx [BREAK]
2011-12-19 22:40:33.136251 [DEBUG] switch_core_state_machine.c:325 (sofia/external/711 at xx.xxx.xx.xx) Running State Change CS_IN
IT
2011-12-19 22:40:33.136251 [DEBUG] switch_core_state_machine.c:361 (sofia/external/711 at xx.xxx.xx.xx) State INIT
2011-12-19 22:40:33.136251 [DEBUG] mod_sofia.c:85 sofia/external/711 at xx.xxx.xx.xx SOFIA INIT
send 1072 bytes to udp/[193.201.229.35]:5060 at 20:40:33.144177:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ------------------------------------------------------------------------
   INVITE sip:711 at xx.xxx.xx.xx SIP/2.0
   Via: SIP/2.0/UDP yy.yyy.yy.yy:5080;rport;branch=z9hG4bK0SepcyQeH1ZvD
   Route: <sip:gw+multifon-4orbit at 193.201.229.35:5060;transport=udp;lr>;gw=multifon-4orbit
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^   
   Max-Forwards: 69
   From: "NTCOM" <sip:271 at yy.yyy.yy.yy>;tag=3B7DcUHFU3DcQ
   To: <sip:711 at xx.xxx.xx.xx>
   Call-ID: 89da3022-a524-122f-b690-bf4d9e35213b
   CSeq: 21827552 INVITE
   Contact: <sip:mod_sofia at yy.yyy.yy.yy:5080>
   User-Agent: FreeSWITCH-mod_sofia/1.0.head-git-4480abc 2011-05-27 21-46-28 -0500
   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, UPDATE, INFO, REGISTER, REFER, NOTIFY
   Supported: timer, precondition, path, replaces
   Allow-Events: talk, hold, refer
   Content-Type: application/sdp
   Content-Disposition: session







On Mon, Dec 19, 2011 at 12:03:04PM -0500, Rob Hutton wrote:
> Without seeing your dialplan, this is just a guess, but, I would bet that your gateway appears before this trunk in the external dialplan and the call matches the regex on the gateway.  So, tighten your regex on the gateway and/or move this entry above the gateway entry.
> 
> 
> On Monday 19 December 2011 11:54:12 Zhuravlov Sergey wrote:
> > Hi,
> > 
> > in my dialplan I try to call directly to the asterisk server follows:
> > 
> > <extension name="ast_NTCOM-711">
> >        <condition field="destination_number" expression="^(711)$">
> >              <action application="set" data="hangup_after_bridge=true"/>
> >              <action application="bridge" data="sofia/external/$1 at ast.er.isk.ip"/>
> >              <action application="hangup"/>
> >        </condition>
> > </extension>
> > 
> > But it does not work for me! If the profile external has gateways then a call goes
> > through a gateway, and receives forbidden.
> > 
> > If in the profile external NOT have gateways  - all is good and asterisk
> > recieve call.
> > 
> > I do not understand why this is happening? Where to look?
> > 
> > 
> > 
> > 

-- 
  Zhuravlov Sergey

  GTALK/JABBER:4orbit at gmail.com



Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list