Summary: | ASTERISK-18917: Asterisk 10 Incorrectly Formats From Header | ||||||
Reporter: | Shaun Clark (shaunc869) | Labels: | |||||
Date Opened: | 2011-11-23 13:53:13.000-0600 | Date Closed: | 2012-01-25 11:19:01.000-0600 | ||||
Priority: | Major | Regression? | |||||
Status: | Closed/Complete | Components: | Channels/chan_sip/General Channels/chan_sip/Messaging | ||||
Versions: | 10.0.0-rc2 | Frequency of Occurrence | |||||
Related Issues: |
| ||||||
Environment: | Attachments: | ( 0) chan_sip.c | |||||
Description: | The default from header when sending a SIP message through MessageSend is: MESSAGE sip:1503XXXXXXX@sms-proxy-01.helloworld.com SIP/2.0 Via: SIP/2.0/UDP 107.22.85.XXX:5060;branch=z9hG4bK7aa08820;rport Max-Forwards: 70 From: "1503597XXXX" <sip:asterisk@107.22.85.XXX>;tag=as4b3a3db7 To: <sip:1503XXXXXXX@sms-proxy-01.helloworld.com> Contact: <sip:asterisk@107.22.85.XXX:5060> Call-ID: 6fc3aa26070d865c33980ccf1c3d7984@174.129.239.190:0 CSeq: 102 MESSAGE User-Agent: Asterisk PBX SVN-branch-10-r346040 To: sip:1503XXXXXXX@sms-proxy-01.helloworld.com Content-Type: text/plain;charset=UTF-8 Content-Length: 10 Hello back --- This fails from my provider with a 484, if I modify the code and force the from header to be like this: <------------> -- Executing [7777@from-internal:1] GoTo("SIP/901-00000001", "messages,7777,1") -- Goto (messages,7777,1) -- Executing [7777@messages:1] Set("SIP/901-00000001", "MESSAGE(Body)=Hello back") in new stack -- Executing [7777@messages:2] MessageSend("SIP/901-00000001", "sip:1503708XXXX@sms-proxy-01.helloworld.com,1503597XXXX") in new stack > ast_get_srv: SRV lookup for '_sip._udp.sms-proxy-01.helloworld.com' mapped to host sipgw-196.lax2.helloworld.com, port 5060 [Nov 23 14:44:30] NOTICE[22493]: chan_sip.c:12149 initreqprep: Using this logger! Reliably Transmitting (NAT) to 67.231.4.196:5060: MESSAGE sip:1503708XXXX@sms-proxy-01.helloworld.com SIP/2.0 Via: SIP/2.0/UDP 107.22.85.xxx:5060;branch=z9hG4bK42acb64d;rport Max-Forwards: 70 From: "1503597XXXX" <sip:1503597XXXX@107.22.85.xxx>;tag=as37c2ef24 To: <sip:1503708XXXX@sms-proxy-01.helloworld.com> Contact: <sip:1503597XXXX@107.22.85.xxx:5060> Call-ID: 778f7a786cd1f49935b5a8131932d247@174.129.239.xxx:0 CSeq: 102 MESSAGE User-Agent: Asterisk PBX SVN-branch-10-r346040M Content-Type: text/plain;charset=UTF-8 Content-Length: 10 Hello back --- Scheduling destruction of SIP dialog '778f7a786cd1f49935b5a8131932d247@174.129.239.xxx:0' in 32000 ms (Method: MESSAGE) -- Auto fallthrough, channel 'SIP/901-00000001' status is 'UNKNOWN' Scheduling destruction of SIP dialog 'NmI2NzMyZGYzMmFhN2FkMmJmMGQ1MTZhZGMzM2I2M2M.' in 32000 m it works fine. So it seems like when I use the command MessageSend with the format: MessageSend(sip:1503708XXXX@sms-proxy-01.bandwidthclec.com,sip:1503597XXXX@sms-proxy-01.bandwidthclec.com) it should produce the second from header example, but instead it currently produces just: From: "1503597XXXX" <sip:asterisk@107.22.85.XXX>;tag=as4b3a3db7 Thanks! | ||||||
Comments: | By: Shaun Clark (shaunc869) 2011-11-23 19:21:28.942-0600 [messages] exten => 7777,1,Set(MESSAGE(Body)=Hello back) ;exten => 7777,2,Set(MESSAGE_DATA(From)=sip:15035978922@sms-proxy-01.bandwidthclec.com) exten => 7777,n,MessageSend(sip:15037081210@sms-proxy-01.bandwidthclec.com,15035978922) exten => 15035978922,1,NoOp(MESSAGE To: ${MESSAGE(to)}) exten => 15035978922,2,NoOp(MESSAGE From: ${MESSAGE(from)}) exten => 15035978922,3,NoOp(MESSAGE Body: ${MESSAGE(body)}) exten => 15035978922,4,Set(MESSAGE(body)=Hello back!) exten => 15035978922,5,MessageSend(sip:15037081210@sms-proxy-01.bandwidthclec.com,15035978922) By: Shaun Clark (shaunc869) 2011-11-23 19:28:36.843-0600 First, I have no clue what I am doing, so I apologize if my code is terrible, but it seems to work for the moment for my case. I was able to modify chan_sip.c to do two things: 1. On lines(s) 12,141 to 12,147 if we have a SIP_MESSAGE, then change the from address from something like <asterisk@ip_address:5060> to whatever I set in the actual from field, so in this case hopefully something like <1503597XXXX@ip_address:5060>, which since the upstream provider is using this to do a security check on if I am authorized to send SMS messages, having something random like "asterisk" gets me denied, while having a recognized inbound SMS number instead allows me to go through. 2. I added two manager events: Line 13,525 -- MessageSent event; I also modified the asterisk-java library to take this event in as well. Line 16,525 -- MessageReceived event; same deal, other way, also added this to asterisk-java. I apologize for not knowing how to package this up as patch, etc. but I am sure if any of this is any good it will make it's way into the source code. Otherwise I look forward to the actual fix. Thanks! Shaun By: David Woolley (davidw) 2011-11-24 05:18:25.187-0600 To provide patched code, you need to: 1) sign the electronic licence grant from the link at the top of the page; 2) create a unified diff; 3) attach that marking it as a code contribution. By: Leif Madsen (lmadsen) 2011-11-29 11:29:40.057-0600 Assigned to reporter to provide a patch per guidelines. By: Richard Mudgett (rmudgett) 2011-12-21 17:51:33.536-0600 Please use "diff -u" or "svn diff" on all your patches. Patches which include alternate formatting are almost certainly going to be thrown out or ignored; there are too few hours in the day to wade through difficult-to-follow C code fixes without the help of diff -u. Thanks! |