<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Hello, I must admit, as a beginner at this, that I have a lot to learn.<br><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">I have written a module to handle some statistics gathering, and it works fine,<br>but my next priority patch leaves me quite puzzled.<br><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">If you or anyone will hear my situation, and offer possible solutions or advice,<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">I would much appreciate the help.<br><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">My next assignment is a patch that was made to chan_sip some years<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">back, that overcomes a problem with older aastra phones that are set up to<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">turn functions keys into blf lights.<br><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Such a phone issues two registrations in quick succession. The first indicates<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">a normal expire= time, and uses the correct CallerID. But the second expiration<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">is presented with a different callerid, but the same sip device, and gives an<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">expires=0, which causes the phone to immediately deregister.<br><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Here is a copy of the debug trace from asterisk:<br><br><br><br>[Jun  5 09:52:47] VERBOSE[30653] chan_sip.c: [Jun  5 09:52:47]<br><--- SIP read from UDP:<a href="http://10.254.129.246:5060">10.254.129.246:5060</a> ---><br>REGISTER sip:<a href="http://10.254.131.239:5060">10.254.131.239:5060</a> SIP/2.0^M<br>Via: SIP/2.0/UDP 10.254.129.246:5060;branch=z9hG4bK352d42fdf5650fdb0^M<br>Max-Forwards: 70^M<br>From: "Steve Murphy" <<a href="http://sip:zugzug49@10.254.131.239:5060">sip:zugzug49@10.254.131.239:5060</a>>;tag=0e79afd6d8^M<br>To: "Steve Murphy" <<a href="http://sip:zugzug49@10.254.131.239:5060">sip:zugzug49@10.254.131.239:5060</a>>^M<br>Call-ID: c1571fa76db23f00^M<br>CSeq: 15958 REGISTER^M<br>Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, OPTIONS, UPDATE, PRACK, SUBSCRIBE, INFO^M<br>Allow-Events: talk, hold, conference, LocalModeStatus^M<br>Authorization: Digest username="zugzug49",realm="<a href="http://phonebooth.oneip.nl">phonebooth.oneip.nl</a>",nonce="371cbeb9",uri="sip:<a href="http://10.254.131.239:5060">10.254.131.239:5060</a>",response="073acacdc9b5d21a1ae7dd0237ee8db3",algorithm=MD5^M<br>Contact: "Steve Murphy" <sip:zugzug@10.254.129.246:5060;transport=udp>;+sip.instance="<urn:uuid:00000000-0000-1000-8000-00085D1A1CBD>";expires=3600^M<br>Supported: path, gruu^M<br>User-Agent: Aastra 57i/3.3.1.2256^M<br>Content-Length: 0^M<br>^M<br><br><-------------><br><br>...<br><br>[Jun  5 09:52:47] VERBOSE[30653] chan_sip.c: [Jun  5 09:52:47]<br><--- SIP read from UDP:<a href="http://10.254.129.246:5060">10.254.129.246:5060</a> ---><br>REGISTER sip:<a href="http://10.254.131.239:5060">10.254.131.239:5060</a> SIP/2.0^M<br>Via: SIP/2.0/UDP 10.254.129.246:5060;branch=z9hG4bKe533d19f33262da61^M<br>Max-Forwards: 70^M<br>From: "Zimbabwe" <<a href="http://sip:oneip49@10.254.131.239:5060">sip:oneip49@10.254.131.239:5060</a>>;tag=d9305fc8ac^M<br>To: "Zimbabwe" <<a href="http://sip:oneip49@10.254.131.239:5060">sip:oneip49@10.254.131.239:5060</a>>^M<br>Call-ID: 78d50aec9c1f4d01^M<br>CSeq: 24058 REGISTER^M<br>Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, OPTIONS, UPDATE, PRACK, SUBSCRIBE, INFO^M<br>Allow-Events: talk, hold, conference, LocalModeStatus^M<br>Authorization: Digest username="oneip49",realm="<a href="http://phonebooth.oneip.nl">phonebooth.oneip.nl</a>",nonce="7319646a",uri="sip:<a href="http://10.254.131.239:5060">10.254.131.239:5060</a>",response="1d350505fce24f726d609d037764959f",algorithm=MD5^M<br>Contact: "Zimbabwe" <sip:oneip49@10.254.129.246:5060;transport=udp>;+sip.instance="<urn:uuid:00000000-0000-1000-8000-00085D1A1CBD>";expires=0^M<br>Supported: path, gruu^M<br>User-Agent: Aastra 57i/3.3.1.2256^M<br>Content-Length: 0^M<br>^M<br><br><-------------><br><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">I have been studying the code, and have determined that the module in<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">res/res_pjsip_registrar would be proper spot to make the change, in the<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">registrar_validate_contacts function. I have but one small problem,<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">and that is, I need to access either the pjsip endpoint object, or the <br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">asterisk object, to retrieve the expire value from the contact header of the first<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">REGISTER request.<br><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">It was easy in the chan_sip code: the peer held the expire value from the first<br>request. <br><br>But in the pjsip world, I am not easily finding this value, which is the expires=x<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">value from the first REGISTER request. Then in the second request, I hope<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">to reject the errant registration based on the difference in contact names between<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">the two requests, and the fact the second request has expire=0, etc.<br><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Again, any help would be appreciated. Conversations like this could be valuable<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">to developers needing to work on res_pjsip.<br><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">murf<br><br clear="all"></div><br>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><br>Steve Murphy<br>ParseTree Corporation<br>57 Lane 17<br>Cody, WY 82414<br>✉  murf at parsetree dot com<br>☎ 307-899-0510</div></div></div></div></div></div></div></div>
</div>