{"action":"closed","issue":{"url":"https://api.github.com/repos/kamailio/kamailio/issues/120","labels_url":"https://api.github.com/repos/kamailio/kamailio/issues/120/labels{/name}","comments_url":"https://api.github.com/repos/kamailio/kamailio/issues/120/comments","events_url":"https://api.github.com/repos/kamailio/kamailio/issues/120/events","html_url":"https://github.com/kamailio/kamailio/issues/120","id":66764241,"number":120,"title":"Unquoted IPv6 Contact header alias parameter causes issues with Asterisk (PJSIP) & TOPOH module","user":{"login":"amessina","id":1409187,"avatar_url":"https://avatars.githubusercontent.com/u/1409187?v=3","gravatar_id":"","url":"https://api.github.com/users/amessina","html_url":"https://github.com/amessina","followers_url":"https://api.github.com/users/amessina/followers","following_url":"https://api.github.com/users/amessina/following{/other_user}","gists_url":"https://api.github.com/users/amessina/gists{/gist_id}","starred_url":"https://api.github.com/users/amessina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amessina/subscriptions","organizations_url":"https://api.github.com/users/amessina/orgs","repos_url":"https://api.github.com/users/amessina/repos","events_url":"https://api.github.com/users/amessina/events{/privacy}","received_events_url":"https://api.github.com/users/amessina/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-04-07T03:31:27Z","updated_at":"2015-07-15T07:37:32Z","closed_at":"2015-07-15T07:37:32Z","body":"When using Kamailio from the master branch, I'm encountering an issue where IPv6 contact address aliases that are added via ```set_contact_alias()``` for WebSocket connections (for example) are unquoted and create problems for Asterisk:\r\n```\r\npjsip:0 <?>:    sip_transport. Error processing 3633 bytes packet from UDP 10.0.0.1:5060 : PJSIP syntax error exception when parsing 'Request Line' header on line 11 col 129:\r\n```\r\nand TOPOH garbles the Request-URI when processing the ACK:\r\n```\r\nWARNING: sanity [sanity.c:236]: check_ruri_scheme(): failed to parse request \r\nuri [�a�{1me▒s�na@50�9���1.�8:�2v0;i��a��=11>7�n7x>10O�2v0~1]\r\n```\r\n\r\nI have tested this with CSipSimple nightly branch (PJSIP) Asterisk 13.2.0 (PJSIP), Google Chrome 41.0.2272.118, and Firefox 37 and all fail to handle the Contact alias parameter properly.\r\n\r\nAn example of an invite that shows this issue follows (this INVITE is without TOPOH on).\r\n```\r\nINVITE sip:testuser@example.com SIP/2.0\r\nRecord-Route: <sip:10.0.0.1;r2=on;lr=on;ftag=t5r2736hf9;nat=yes>\r\nRecord-Route: <sip:[2001:db8::98]:5061;transport=ws;r2=on;lr=on;ftag=t5r2736hf9;nat=yes>\r\nVia: SIP/2.0/UDP 10.0.0.1;branch=z9hG4bKa3e8.2bb6508fbc0cf8cc55c1eb6c0eca0b38.0\r\nVia: SIP/2.0/WSS 2e6orc23ptjv.invalid;rport=43691;received=2001:db8::99;branch=z9hG4bK450538\r\nMax-Forwards: 69\r\nTo: <sip:testuser@example.com>\r\nFrom: \"WS Test User 1\" <sip:wstest1@example.com>;tag=t5r2736hf9\r\nCall-ID: uugmpjgjpoklrnf0um56\r\nCSeq: 7244 INVITE\r\nContact: <sip:wstest1@example.com;gr=urn:uuid:2e54e8a2-66e4-433a-a024-b57f3665a44b;alias=[2001:db8::99]~43691~6>\r\nAllow: ACK,CANCEL,BYE,OPTIONS,INFO,NOTIFY,INVITE\r\nContent-Type: application/sdp\r\nSupported: gruu,outbound\r\nUser-Agent: SIP.js/0.6.4\r\nContent-Length: 2768\r\n\r\nv=0\r\no=- 867554869709517848 2 IN IP4 10.0.0.1\r\ns=-\r\nt=0 0\r\na=msid-semantic: WMS livWfUwMWQJMemgnFyBQDf1VXUo9Q0AXwHnH\r\nm=audio 30158 RTP/SAVP 111 103 104 9 0 8 106 105 13 126\r\nc=IN IP4 10.0.0.1\r\na=rtpmap:111 opus/48000/2\r\na=fmtp:111 minptime=10; useinbandfec=1\r\na=rtpmap:103 ISAC/16000\r\na=rtpmap:104 ISAC/32000\r\na=rtpmap:9 G722/8000\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:106 CN/32000\r\na=rtpmap:105 CN/16000\r\na=rtpmap:13 CN/8000\r\na=rtpmap:126 telephone-event/8000\r\na=maxptime:60\r\na=ssrc:1444733772 cname:CuBdEZ9bIWQc1sE+\r\na=ssrc:1444733772 msid:livWfUwMWQJMemgnFyBQDf1VXUo9Q0AXwHnH ebd0066b-73b9-467c-b696-36e0fa7d72b7\r\na=ssrc:1444733772 mslabel:livWfUwMWQJMemgnFyBQDf1VXUo9Q0AXwHnH\r\na=ssrc:1444733772 label:ebd0066b-73b9-467c-b696-36e0fa7d72b7\r\na=sendrecv\r\na=rtcp:30159\r\na=rtcp-mux\r\na=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:/fmyETo1BwAlupltb64sy5Za6e37BW0p5jMmvqHU\r\na=setup:actpass\r\na=fingerprint:sha-1 76:27:60:1E:64:94:B4:6E:8A:64:72:2D:41:2C:B8:F3:FF:4C:1D:56\r\na=ice-ufrag:U4XlaM4U\r\na=ice-pwd:HqnTPTU5DY3j1yB4XVEL9rs1tn\r\na=candidate:vVzo18e51E8EXCNy 1 UDP 2130706431 10.0.0.1 30158 typ host\r\na=candidate:vVzo18e51E8EXCNy 2 UDP 2130706430 10.0.0.1 30159 typ host\r\na=candidate:xCpWH2paVucFSQXn 1 UDP 2130706175 2001:db8::1 30158 typ host\r\na=candidate:xCpWH2paVucFSQXn 2 UDP 2130706174 2001:db8::1 30159 typ host\r\nm=video 30196 RTP/SAVP 100 116 117 96\r\nc=IN IP4 10.0.0.1\r\na=rtpmap:100 VP8/90000\r\na=rtcp-fb:100 ccm fir\r\na=rtcp-fb:100 nack\r\na=rtcp-fb:100 nack pli\r\na=rtcp-fb:100 goog-remb\r\na=rtpmap:116 red/90000\r\na=rtpmap:117 ulpfec/90000\r\na=rtpmap:96 rtx/90000\r\na=fmtp:96 apt=100\r\na=ssrc-group:FID 616715905 3177427003\r\na=ssrc:616715905 cname:CuBdEZ9bIWQc1sE+\r\na=ssrc:616715905 msid:livWfUwMWQJMemgnFyBQDf1VXUo9Q0AXwHnH bb5df7ec-28a9-4e94-89a3-2ebb45a9f5bb\r\na=ssrc:616715905 mslabel:livWfUwMWQJMemgnFyBQDf1VXUo9Q0AXwHnH\r\na=ssrc:616715905 label:bb5df7ec-28a9-4e94-89a3-2ebb45a9f5bb\r\na=ssrc:3177427003 cname:CuBdEZ9bIWQc1sE+\r\na=ssrc:3177427003 msid:livWfUwMWQJMemgnFyBQDf1VXUo9Q0AXwHnH bb5df7ec-28a9-4e94-89a3-2ebb45a9f5bb\r\na=ssrc:3177427003 mslabel:livWfUwMWQJMemgnFyBQDf1VXUo9Q0AXwHnH\r\na=ssrc:3177427003 label:bb5df7ec-28a9-4e94-89a3-2ebb45a9f5bb\r\na=sendrecv\r\na=rtcp:30197\r\na=rtcp-mux\r\na=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:qQRmOwum0YFHgKKzt2dRX0uAQhSwlmxscI3P3JUI\r\na=setup:actpass\r\na=fingerprint:sha-1 76:27:60:1E:64:94:B4:6E:8A:64:72:2D:41:2C:B8:F3:FF:4C:1D:56\r\na=ice-ufrag:ISaptX08\r\na=ice-pwd:mxP343kHexU8SwtbCeRj4WyMNI\r\na=candidate:vVzo18e51E8EXCNy 1 UDP 2130706431 10.0.0.1 30196 typ host\r\na=candidate:vVzo18e51E8EXCNy 2 UDP 2130706430 10.0.0.1 30197 typ host\r\na=candidate:xCpWH2paVucFSQXn 1 UDP 2130706175 2001:db8::1 30196 typ host\r\na=candidate:xCpWH2paVucFSQXn 2 UDP 2130706174 2001:db8::1 30197 typ host\r\n```\r\n\r\nI believe that the Contact header alias parameter might need quotes in order to properly handle the bracketed IPv6 alias address, something like the following, but unfortunately I haven't been able to find evidence to be certain that this is the fix, though I do notice that parameters in headers with special characters like brackets are often quoted.\r\n```\r\nContact: <sip:wstest1@example.com;gr=urn:uuid:2e54e8a2-66e4-433a-a024-b57f3665a44b;alias=\"[2001:db8::99]~43691~6\">\r\n```"}}