[Home]

Summary:ASTERISK-24221: chan_sip: SRV lookup is not performed when using a realtime peer
Reporter:Leandro Dardini (ldardini)Labels:
Date Opened:2014-08-12 15:39:59Date Closed:2014-09-17 12:23:14
Priority:MinorRegression?
Status:Closed/CompleteComponents:Channels/chan_sip/General
Versions:12.2.0 12.4.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Attachments:( 0) sip_show_settings.txt
Description:When dialing a trunk defined as realtime, (using odbc connector), the host is not resolved using SRV, but just queried for the A record, despite having srvlookup set to yes.
Comments:By: Matt Jordan (mjordan) 2014-08-13 09:38:47.075-0500

Thank you for taking the time to report this bug and helping to make Asterisk better. Unfortunately, we cannot work on this bug because your description did not include enough information. You may find it helpful to read the Asterisk Issue Guidelines http://www.asterisk.org/developers/bug-guidelines. We would be grateful if you would then provide a more complete description of the problem. At a minimum, we need:

1. the specific steps or actions you took that caused you to encounter the problem,
2. the behavior you expected, and
3. the behavior you actually encountered (in as much detail as possible).

This likely includes output from the console with debug level logging, a SIP trace (if this is SIP related), and configuration information such as dialplan (e.g. extensions.conf) and channel configuration (e.g. sip.conf). Thanks!



By: Leandro Dardini (ldardini) 2014-08-13 10:21:05.537-0500

Thank you for checking this issue. I take the time to upgrade to latest version and rerun all the tests:

I setup an extension, 103-DEVEL to dial 98100 and have that number to be routed to "voxout" Realtime SIP Peer. This is the result:

In the asterisk console I find:
{noformat}
   -- Executing [_X.@dialoutbound:167] Dial("SIP/103-DEVEL-0000014b", "SIP/98100@voxout,30,TtX") in new stack
[2014-08-13 17:09:14] ERROR[11368][C-00000149]: netsock2.c:303 ast_sockaddr_resolve: getaddrinfo("voxout.voxbone.com", "(null)", ...): Name or service not known
[2014-08-13 17:09:14] WARNING[11368][C-00000149]: acl.c:800 resolve_first: Unable to lookup 'voxout.voxbone.com'
[2014-08-13 17:09:14] WARNING[11368][C-00000149]: app_dial.c:2421 dial_exec_full: Unable to create channel of type 'SIP' (cause 20 - Subscriber absent)
 == Everyone is busy/congested at this time (1:0/0/1)
{noformat}
Debug shows the following info:
{noformat}
[2014-08-13 17:09:14] DEBUG[11368][C-00000149] pbx.c: Launching 'Dial'
[2014-08-13 17:09:14] VERBOSE[11368][C-00000149] pbx.c:     -- Executing [_X.@dialoutbound:167] Dial("SIP/103-DEVEL-0000014b", "SIP/98100@voxout,30,TtX") in new stack
[2014-08-13 17:09:14] DEBUG[11368][C-00000149] chan_sip.c: Asked to create a SIP channel with formats: (alaw)
[2014-08-13 17:09:14] DEBUG[11368][C-00000149] chan_sip.c: Allocating new SIP dialog for 24707bbf710f66b73367f9a274c9da99@213.133.102.85:5060 - INVITE (No RTP)
[2014-08-13 17:09:14] DEBUG[11368][C-00000149] res_config_odbc.c: Skip: 0; SQL: SELECT * FROM sipfriends WHERE name = ? AND host = ?
[2014-08-13 17:09:14] DEBUG[11368][C-00000149] res_config_odbc.c: Parameter 1 ('name') = 'voxout'
[2014-08-13 17:09:14] DEBUG[11368][C-00000149] res_config_odbc.c: Parameter 2 ('host') = 'dynamic'
[2014-08-13 17:09:14] DEBUG[11368][C-00000149] res_odbc.c: odbc_release_obj2(0x2d7c308) called (obj->txf = (nil))
[2014-08-13 17:09:14] DEBUG[11368][C-00000149] res_config_odbc.c: Skip: 0; SQL: SELECT * FROM sipfriends WHERE name = ? AND host = ?
[2014-08-13 17:09:14] DEBUG[11368][C-00000149] res_config_odbc.c: Parameter 1 ('name') = 'voxout'
[2014-08-13 17:09:14] DEBUG[11368][C-00000149] res_config_odbc.c: Parameter 2 ('host') = 'dynamic'
[2014-08-13 17:09:14] DEBUG[11368][C-00000149] res_odbc.c: odbc_release_obj2(0x2dabb38) called (obj->txf = (nil))
[2014-08-13 17:09:14] DEBUG[11368][C-00000149] res_config_odbc.c: Skip: 0; SQL: SELECT * FROM sipfriends WHERE name = ?
[2014-08-13 17:09:14] DEBUG[11368][C-00000149] res_config_odbc.c: Parameter 1 ('name') = 'voxout'
[2014-08-13 17:09:14] DEBUG[11368][C-00000149] res_odbc.c: odbc_release_obj2(0x2d7c308) called (obj->txf = (nil))
[2014-08-13 17:09:14] DEBUG[11368][C-00000149] netsock2.c: Splitting 'voxout.voxbone.com' into...
[2014-08-13 17:09:14] DEBUG[11368][C-00000149] netsock2.c: ...host 'voxout.voxbone.com' and port ''.
[2014-08-13 17:09:14] DEBUG[11368][C-00000149] dnsmgr.c: doing dnsmgr_lookup for 'voxout.voxbone.com'
[2014-08-13 17:09:14] DEBUG[11368][C-00000149] netsock2.c: Splitting 'voxout.voxbone.com' into...
[2014-08-13 17:09:14] DEBUG[11368][C-00000149] netsock2.c: ...host 'voxout.voxbone.com' and port ''.
[2014-08-13 17:09:14] ERROR[11368][C-00000149] netsock2.c: getaddrinfo("voxout.voxbone.com", "(null)", ...): Name or service not known
[2014-08-13 17:09:14] WARNING[11368][C-00000149] acl.c: Unable to lookup 'voxout.voxbone.com'
[2014-08-13 17:09:14] DEBUG[11368][C-00000149] chan_sip.c: Not an IPv4 nor IPv6 address, cannot set port.
[2014-08-13 17:09:14] DEBUG[11368][C-00000149] chan_sip.c: Not an IPv4 nor IPv6 address, cannot get port.
[2014-08-13 17:09:14] DEBUG[11368][C-00000149] chan_sip.c: Not an IPv4 nor IPv6 address, cannot set port.
[2014-08-13 17:09:14] DEBUG[11368][C-00000149] chan_sip.c: Not an IPv4 nor IPv6 address, cannot get port.
[2014-08-13 17:09:14] DEBUG[11368][C-00000149] chan_sip.c: Not an IPv4 nor IPv6 address, cannot set port.
[2014-08-13 17:09:14] DEBUG[11368][C-00000149] chan_sip.c: -REALTIME- loading peer from database to memory. Name: voxout. Peer objects: 0
[2014-08-13 17:09:14] DEBUG[11368][C-00000149] chan_sip.c: Cant create SIP call - target device not registered
[2014-08-13 17:09:14] DEBUG[11368][C-00000149] chan_sip.c: Destroying SIP dialog 24707bbf710f66b73367f9a274c9da99@213.133.102.85:5060
[2014-08-13 17:09:14] WARNING[11368][C-00000149] app_dial.c: Unable to create channel of type 'SIP' (cause 20 - Subscriber absent)
[2014-08-13 17:09:14] VERBOSE[11368][C-00000149] app_dial.c:   == Everyone is busy/congested at this time (1:0/0/1)
{noformat}
Output for "sip show settings" is attached.

The sipfriend table has been populated with the following query (there are some extra fields)
{noformat}
INSERT INTO `sipfriends` (`id`, `te_id`, `name`, `ipaddr`, `port`, `regseconds`, `defaultuser`, `fullcontact`, `regserver`, `useragent`, `lastms`, `host`, `type`, `context`, `deny`, `permit`, `secret`, `md5secret`, `remotesecret`, `transport`, `dtmfmode`, `directmedia`, `nat`, `canreinvite`, `callgroup`, `pickupgroup`, `language`, `disallow`, `allow`, `insecure`, `trustrpid`, `progressinband`, `promiscredir`, `useclientcode`, `accountcode`, `setvar`, `callerid`, `amaflags`, `callcounter`, `busylevel`, `allowoverlap`, `allowsubscribe`, `videosupport`, `maxcallbitrate`, `rfc2833compensate`, `mailbox`, `session-timers`, `session-expires`, `session-minse`, `session-refresher`, `t38pt_usertpsource`, `regexten`, `fromdomain`, `fromuser`, `qualify`, `defaultip`, `rtptimeout`, `rtpholdtimeout`, `sendrpid`, `outboundproxy`, `callbackextension`, `registertrying`, `timert1`, `timerb`, `qualifyfreq`, `constantssrc`, `contactpermit`, `contactdeny`, `usereqphone`, `textsupport`, `faxdetect`, `buggymwi`, `auth`, `fullname`, `trunkname`, `cid_number`, `callingpres`, `mohinterpret`, `mohsuggest`, `parkinglot`, `hasvoicemail`, `subscribemwi`, `vmexten`, `autoframing`, `rtpkeepalive`, `call-limit`, `g726nonstandard`, `ignoresdpversion`, `allowtransfer`, `dynamic`, `encryption`, `notifyringing`) VALUES
(1046, 0, 'voxout', NULL, 5060, NULL, 'pippo', NULL, NULL, NULL, NULL, 'voxout.voxbone.com', NULL, 'fromoutside', '', NULL, 'pluto', NULL, NULL, 'UDP', 'auto', NULL, 'no', '', NULL, NULL, NULL, 'all', 'alaw;ulaw;gsm', 'port,invite', 'yes', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '', '', NULL, NULL, NULL, NULL, 'yes', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 5, NULL, NULL, NULL, NULL, NULL, NULL, 'yes');
{noformat}
If I check the DNS traffic while dialing, only a A search is performed:
{noformat}
17:19:49.778464 IP 213.133.102.85.51728 > 213.133.100.100.domain: 2677+ A? voxout.voxbone.com. (36)
       0x0000:  4500 0040 3688 4000 4011 8e60 d585 6655  E..@6.@.@..`..fU
       0x0010:  d585 6464 ca10 0035 002c c6f4 0a75 0100  ..dd...5.,...u..
       0x0020:  0001 0000 0000 0000 0676 6f78 6f75 7407  .........voxout.
       0x0030:  766f 7862 6f6e 6503 636f 6d00 0001 0001  voxbone.com.....
17:19:49.781411 IP 213.133.100.100.domain > 213.133.102.85.51728: 2677 0/1/0 (97)
       0x0000:  4500 007d 1e20 0000 3b11 eb8b d585 6464  E..}....;.....dd
       0x0010:  d585 6655 0035 ca10 0069 50e6 0a75 8180  ..fU.5...iP..u..
       0x0020:  0001 0000 0001 0000 0676 6f78 6f75 7407  .........voxout.
       0x0030:  766f 7862 6f6e 6503 636f 6d00 0001 0001  voxbone.com.....
       0x0040:  c013 0006 0001 0000 0a43 0031 036e 7330  .........C.1.ns0
       0x0050:  0b64 6e73 6d61 6465 6561 7379 c01b 0866  .dnsmadeeasy...f
       0x0060:  7261 6e63 6f69 73c0 1377 914a 6b00 00a8  rancois..w.Jk...
       0x0070:  c000 000e 1000 1275 0000 000e 10         .......u.....
17:19:49.781510 IP 213.133.102.85.32894 > 213.133.100.100.domain: 7987+ A? voxout.voxbone.com. (36)
       0x0000:  4500 0040 368b 4000 4011 8e5d d585 6655  E..@6.@.@..]..fU
       0x0010:  d585 6464 807e 0035 002c fbc8 1f33 0100  ..dd.~.5.,...3..
       0x0020:  0001 0000 0000 0000 0676 6f78 6f75 7407  .........voxout.
       0x0030:  766f 7862 6f6e 6503 636f 6d00 0001 0001  voxbone.com.....
17:19:49.784439 IP 213.133.100.100.domain > 213.133.102.85.32894: 7987 0/1/0 (97)
       0x0000:  4500 007d 1e21 0000 3b11 eb8a d585 6464  E..}.!..;.....dd
       0x0010:  d585 6655 0035 807e 0069 85ba 1f33 8180  ..fU.5.~.i...3..
       0x0020:  0001 0000 0001 0000 0676 6f78 6f75 7407  .........voxout.
       0x0030:  766f 7862 6f6e 6503 636f 6d00 0001 0001  voxbone.com.....
       0x0040:  c013 0006 0001 0000 0a43 0031 036e 7330  .........C.1.ns0
       0x0050:  0b64 6e73 6d61 6465 6561 7379 c01b 0866  .dnsmadeeasy...f
       0x0060:  7261 6e63 6f69 73c0 1377 914a 6b00 00a8  rancois..w.Jk...
       0x0070:  c000 000e 1000 1275 0000 000e 10         .......u.....
{noformat}
If I check for DNS SRV record for voxout, I find the correct info:
{noformat}
[root@srv01 asterisk-12.4.0]# host -t SRV _sip._udp.voxout.voxbone.com
_sip._udp.voxout.voxbone.com has SRV record 1 10 5060 be.voxout.voxbone.com.
_sip._udp.voxout.voxbone.com has SRV record 1 10 5060 de.voxout.voxbone.com.
{noformat}

By: Matt Jordan (mjordan) 2014-08-14 10:45:52.410-0500

What is the value of {{srvlookup}} in your {{[general]}} section?

By: Leandro Dardini (ldardini) 2014-08-14 12:31:51.554-0500

The value of srvlookup is "yes". I have checked and when using the same provider setting in the sip.conf file, it works perfectly.

By: Michael L. Young (elguero) 2014-09-16 20:47:55.964-0500

-What is the "port" column set to in the table for this realtime peer voxout?-

I just saw the INSERT up above in your prior comment... I think I see the problem...

The reason why an A lookup is performed instead of the SRV is commented in the code:

{noformat}
/* Section 4.2 of RFC 3263 specifies that if a port number is specified, then
* an A record lookup should be used instead of SRV.
*/
{noformat}

Try setting the port to being empty... set it to "" and see if the SRV lookup is then performed.

By: Leandro Dardini (ldardini) 2014-09-17 12:16:31.343-0500

Yes, I confirm by setting the port to zero lead to a DNS SRV lookup. Is there any penitence for reporting not existent bugs? :-) Thank you

By: Michael L. Young (elguero) 2014-09-17 12:22:55.991-0500

Thanks for the feedback.  No worries.  It happens to all of us from time to time.