[asterisk-bugs] [JIRA] (ASTERISK-19720) Using SIP realtime with caching incoming calls are routed to dialplan context specified in sip.conf general context and not the context specified in SIP peer context until peer is refreshed from database

Joshua Colp (JIRA) noreply at issues.asterisk.org
Tue Dec 19 06:01:07 CST 2017


     [ https://issues.asterisk.org/jira/browse/ASTERISK-19720?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joshua Colp updated ASTERISK-19720:
-----------------------------------

    Affects Version/s: 13.18.4

> Using SIP realtime with caching incoming calls are routed to dialplan context specified in sip.conf general context and not the context specified in SIP peer context until peer is refreshed from database
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: ASTERISK-19720
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-19720
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Channels/chan_sip/General, PBX/pbx_realtime
>    Affects Versions: 1.8.11.0, 13.18.4
>         Environment: Ubuntu Lucid 10.04, 
> Asterisk 1.8.11.0-1digium1~lucid built by pbuilder @ nighthawk on a x86_64 running Linux on 2012-04-03 14:12:25 UTC
>            Reporter: Serge Wagener
>
> I work for an OSS project which relies on asterisk for telecom. My task was to port asterisk config from flat files to realtime db. Everything works great except the following:
> I have a "from-sip-external" context set up in general section of sip.conf for unknown incoming sip calls.
> Then i have a "from-trunk" context associated to the SIP peer's in sip_devices table for incoming calls on these defined sip trunks.
> Caching is enabled, just as info. 
> After a core reload, or fresh asterisk service start, the SIP peer table is obviously empty. Incoming calls on any DID get then redirected to the "from-sip-external" context set in general of sip.conf instead of the context set in the peer table.
> After doing one outgoing call on the same line i can see the line in the SIP peer cache, which is normal since i enabled caching. As long as the peer is in the cache table incoming calls work like a charm, and callers get directed to the right context set in peer definition in sip_devices table.
> So as long as i do not restart asterisk or reload core it will be fine forever ....
> Experts in #asterisk think this might be a bug. See a call example here, my comments in CAPS to easely identify:
> PEER DUMP JUST AFTER ASTERISK RELOAD:
> dcerouter*CLI> sip show peers
> Name/username              Host                                    Dyn Forcerport ACL Port     Status     Realtime
> 313/313                    192.168.80.177                           D   N             5060     Unmonitored Cached RT
> 1 sip peers [Monitored: 0 online, 0 offline Unmonitored: 1 online, 0 offline]
> THIS DUMP SHOWS ONE OF THE PHONES THAT JUST REGISTERED AFTER MY CORE RELOAD
> INCOMING CALL USING WRONG CONTEXT:
>   == Using SIP RTP CoS mark 5
>     -- Executing [498621 at from-sip-external:1] NoOp("SIP/85.93.219.122-00000084", "Received incoming SIP connection from unknown peer to 498621") in new stack
>     -- Executing [498621 at from-sip-external:2] Set("SIP/85.93.219.122-00000084", "DID=498621") in new stack
>     -- Executing [498621 at from-sip-external:3] Goto("SIP/85.93.219.122-00000084", "s,1") in new stack
>     -- Goto (from-sip-external,s,1)
>     -- Executing [s at from-sip-external:1] GotoIf("SIP/85.93.219.122-00000084", "0?from-trunk,498621,1") in new stack
>     -- Executing [s at from-sip-external:2] Set("SIP/85.93.219.122-00000084", "TIMEOUT(absolute)=15") in new stack
> Channel will hangup at 2012-04-13 14:33:51.265 CEST.
>     -- Executing [s at from-sip-external:3] Answer("SIP/85.93.219.122-00000084", "") in new stack
>     -- Executing [s at from-sip-external:4] Wait("SIP/85.93.219.122-00000084", "2") in new stack
>     -- Executing [s at from-sip-external:5] Playback("SIP/85.93.219.122-00000084", "ss-noservice") in new stack
>     -- <SIP/85.93.219.122-00000084> Playing 'ss-noservice.gsm' (language 'en')
>   == Spawn extension (from-sip-external, s, 5) exited non-zero on 'SIP/85.93.219.122-00000084'
>     -- Executing [h at from-sip-external:1] NoOp("SIP/85.93.219.122-00000084", "Hangup") in new stack
> dcerouter*CLI> 498621
> SIP SHOW PEERS IS STILL THE SAME AFTER THIS INCOMING CALL.
> SO I MAKE AN OUTGOING CALL USING THIS PHONELINE, AND THEN A NEW SIP SHOW PEERS:
> dcerouter*CLI> sip show peers
> Name/username              Host                                    Dyn Forcerport ACL Port     Status     Realtime
> 313/313                    192.168.80.177                           D   N             5060     Unmonitored Cached RT
> 498621/498621              85.93.219.114                                N             5060     UNKNOWN    Cached RT
> 2 sip peers [Monitored: 0 online, 1 offline Unmonitored: 1 online, 0 offline]
> THE PHONELINE IS NOW IN PEER CACHE AND INCOMING CALLS WORK, THIS TIME IS USES RIGHT CONTEXT:
>   == Using SIP RTP CoS mark 5
>     -- Executing [498621 at from-trunk:1] Set("SIP/498621-00000087", "__FROM_DID=498621")
>     -- Executing [498621 at from-trunk:2] Set("SIP/498621-00000087", "CALLERID(num)=691543912")
>     -- Executing [498621 at from-trunk:3] Noop("SIP/498621-00000087", "Incoming call from 691543912")
>     -- Executing [498621 at from-trunk:4] Set("SIP/498621-00000087", "FAX_RX=")
>     -- Executing [498621 at from-trunk:5] Goto("SIP/498621-00000087", "custom-linuxmce,106,1")
>     -- Goto (custom-linuxmce,106,1)
>     -- Executing [106 at custom-linuxmce:1] AGI("SIP/498621-00000087", "lmce-phonebook-lookup.agi")
>     -- Launched AGI Script /usr/share/asterisk/agi-bin/lmce-phonebook-lookup.agi
>     -- AGI Script Executing Application: (NoOp) Options: (Checking if name exists for 691543912 in phone book and attempting to add caller name)
>     -- AGI Script Executing Application: (NoOp) Options: (Number found in phone book, PK_CONTACT is 2)
>     -- AGI Script Executing Application: (NoOp) Options: (Name for 691543912 is Serge Wagener)
>     -- AGI Script Executing Application: (Set) Options: (CALLERID(name)=Serge Wagener)
>     -- <SIP/498621-00000087>AGI Script lmce-phonebook-lookup.agi completed, returning 0
> [... cut here ...]
> SIP_DEVICES TABLE DUMP
> --
> -- Table structure for table `sip_devices`
> --
> CREATE TABLE IF NOT EXISTS `sip_devices` (
>   `id` int(11) NOT NULL AUTO_INCREMENT,
>   `name` varchar(80) NOT NULL DEFAULT '',
>   `context` varchar(80) DEFAULT NULL,
>   `callingpres` enum('allowed_not_screened','allowed_passed_screen','allowed_failed_screen','allowed','prohib_not_screened','prohib_passed_screen','prohib_failed_screen','prohib','unavailable') DEFAULT 'allowed_not_screened',
>   `deny` varchar(95) DEFAULT NULL,
>   `permit` varchar(95) DEFAULT NULL,
>   `secret` varchar(80) DEFAULT NULL,
>   `md5secret` varchar(80) DEFAULT NULL,
>   `remotesecret` varchar(250) DEFAULT NULL,
>   `transport` enum('tcp','udp','udp,tcp') DEFAULT 'udp,tcp',
>   `host` varchar(31) NOT NULL DEFAULT 'dynamic',
>   `nat` varchar(5) NOT NULL DEFAULT 'yes',
>   `type` enum('user','peer','friend') NOT NULL DEFAULT 'friend',
>   `accountcode` varchar(20) DEFAULT NULL,
>   `amaflags` varchar(13) DEFAULT NULL,
>   `callgroup` varchar(10) DEFAULT NULL,
>   `callerid` varchar(80) DEFAULT NULL,
>   `defaultip` varchar(15) DEFAULT NULL,
>   `dtmfmode` varchar(7) DEFAULT 'auto',
>   `fromuser` varchar(80) DEFAULT NULL,
>   `fromdomain` varchar(80) DEFAULT NULL,
>   `insecure` varchar(20) DEFAULT NULL,
>   `language` char(2) DEFAULT NULL,
>   `mailbox` varchar(50) DEFAULT NULL,
>   `pickupgroup` varchar(10) DEFAULT NULL,
>   `qualify` char(3) DEFAULT 'no',
>   `regexten` varchar(80) DEFAULT NULL,
>   `rtptimeout` char(3) DEFAULT NULL,
>   `rtpholdtimeout` char(3) DEFAULT NULL,
>   `setvar` varchar(100) DEFAULT NULL,
>   `disallow` varchar(100) DEFAULT 'all',
>   `allow` varchar(100) DEFAULT 'alaw;ulaw',
>   `fullcontact` varchar(80) NOT NULL DEFAULT '',
>   `ipaddr` varchar(45) NOT NULL,
>   `port` mediumint(5) unsigned NOT NULL DEFAULT '0',
>   `defaultuser` varchar(80) NOT NULL DEFAULT '',
>   `subscribecontext` varchar(80) DEFAULT NULL,
>   `directmedia` enum('yes','no') DEFAULT 'no',
>   `trustrpid` enum('yes','no') DEFAULT NULL,
>   `sendrpid` enum('yes','no') DEFAULT NULL,
>   `progressinband` enum('never','yes','no') DEFAULT NULL,
>   `promiscredir` enum('yes','no') DEFAULT NULL,
>   `useclientcode` enum('yes','no') DEFAULT NULL,
>   `callcounter` enum('yes','no') DEFAULT NULL,
>   `busylevel` int(10) unsigned DEFAULT NULL,
>   `allowoverlap` enum('yes','no') DEFAULT 'yes',
>   `allowsubscribe` enum('yes','no') DEFAULT 'yes',
>   `allowtransfer` enum('yes','no') DEFAULT 'yes',
>   `ignoresdpversion` enum('yes','no') DEFAULT 'no',
>   `template` varchar(100) DEFAULT NULL,
>   `videosupport` enum('yes','no','always') DEFAULT 'no',
>   `maxcallbitrate` int(10) unsigned DEFAULT NULL,
>   `rfc2833compensate` enum('yes','no') DEFAULT 'yes',
>   `session-timers` enum('originate','accept','refuse') DEFAULT 'accept',
>   `session-expires` int(5) unsigned DEFAULT '1800',
>   `session-minse` int(5) unsigned DEFAULT '90',
>   `session-refresher` enum('uac','uas') DEFAULT 'uas',
>   `t38pt_usertpsource` enum('yes','no') DEFAULT NULL,
>   `outboundproxy` varchar(250) DEFAULT NULL,
>   `callbackextension` varchar(250) DEFAULT NULL,
>   `registertrying` enum('yes','no') DEFAULT 'yes',
>   `timert1` int(5) unsigned DEFAULT '500',
>   `timerb` int(8) unsigned DEFAULT NULL,
>   `qualifyfreq` int(5) unsigned DEFAULT '120',
>   `contactpermit` varchar(250) DEFAULT NULL,
>   `contactdeny` varchar(250) DEFAULT NULL,
>   `lastms` int(11) NOT NULL,
>   `regserver` varchar(100) NOT NULL DEFAULT '',
>   `regseconds` int(11) NOT NULL DEFAULT '0',
>   `useragent` varchar(50) NOT NULL DEFAULT '',
>   PRIMARY KEY (`id`),
>   UNIQUE KEY `name` (`name`,`fromuser`)
> ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=12 ;
> --
> -- Dumping data for table `sip_devices`
> --
> INSERT INTO `sip_devices` (`id`, `name`, `context`, `callingpres`, `deny`, `permit`, `secret`, `md5secret`, `remotesecret`, `transport`, `host`, `nat`, `type`, `accountcode`, `amaflags`, `callgroup`, `callerid`, `defaultip`, `dtmfmode`, `fromuser`, `fromdomain`, `insecure`, `language`, `mailbox`, `pickupgroup`, `qualify`, `regexten`, `rtptimeout`, `rtpholdtimeout`, `setvar`, `disallow`, `allow`, `fullcontact`, `ipaddr`, `port`, `defaultuser`, `subscribecontext`, `directmedia`, `trustrpid`, `sendrpid`, `progressinband`, `promiscredir`, `useclientcode`, `callcounter`, `busylevel`, `allowoverlap`, `allowsubscribe`, `allowtransfer`, `ignoresdpversion`, `template`, `videosupport`, `maxcallbitrate`, `rfc2833compensate`, `session-timers`, `session-expires`, `session-minse`, `session-refresher`, `t38pt_usertpsource`, `outboundproxy`, `callbackextension`, `registertrying`, `timert1`, `timerb`, `qualifyfreq`, `contactpermit`, `contactdeny`, `lastms`, `regserver`, `regseconds`, `useragent`) VALUES
> (1, '200', 'from-internal', 'allowed_not_screened', NULL, NULL, 'toto', NULL, NULL, 'udp,tcp', 'dynamic', 'yes', 'friend', NULL, NULL, NULL, 'device <200>', NULL, 'auto', NULL, NULL, NULL, NULL, '200 at device', NULL, 'no', NULL, NULL, NULL, NULL, 'all', 'alaw;ulaw', '', '', 5061, '200', NULL, 'no', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'yes', 'yes', 'yes', 'no', NULL, 'no', NULL, 'yes', 'accept', 1800, 90, 'uas', NULL, NULL, NULL, 'yes', 500, NULL, 120, NULL, NULL, 0, '', 0, ''),
> (6, '313', 'from-internal', 'allowed_not_screened', NULL, NULL, 'toto', NULL, NULL, 'udp,tcp', 'dynamic', 'yes', 'friend', NULL, NULL, NULL, 'device <313>', NULL, 'auto', NULL, NULL, NULL, NULL, '313 at device', NULL, 'no', NULL, NULL, NULL, NULL, 'all', 'alaw;ulaw', 'sip:313 at 192.168.80.177:5060', '192.168.80.177', 5060, '313', NULL, 'no', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'yes', 'yes', 'yes', 'no', NULL, 'no', NULL, 'yes', 'accept', 1800, 90, 'uas', NULL, NULL, NULL, 'yes', 500, NULL, 120, NULL, NULL, 0, '', 1334321186, 'C610 IP/42.051.01.000.000'),
> (11, '498621', 'from-trunk', 'allowed_not_screened', NULL, NULL, 'toto', NULL, NULL, 'udp,tcp', 'tel.lu', 'yes', 'peer', NULL, NULL, NULL, '498621', NULL, 'auto', '498621', 'tel.lu', 'port,invite', NULL, NULL, NULL, 'yes', NULL, NULL, NULL, NULL, 'all', 'alaw;ulaw', '', '', 5060, '498621', NULL, 'no', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'yes', 'yes', 'yes', 'no', NULL, 'no', NULL, 'yes', 'accept', 1800, 90, 'uas', NULL, NULL, NULL, 'yes', 500, NULL, 120, NULL, NULL, 0, '', 0, '');



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list