[SR-Users] Framework/Lib to create SIP packets
Igor Olhovskiy
igorolhovskiy at gmail.com
Wed Mar 30 22:00:01 CEST 2016
- then why are you asking this on kamailio mailing list? :)
I know here are many SIP-developers. Question about SIP, and receiver of
this message would be Kamailio :)
2016-03-30 22:52 GMT+03:00 Alex Balashov <abalashov at evaristesys.com>:
> On 03/30/2016 03:47 PM, Igor Olhovskiy wrote:
>
> Oh… Node. Too async for me ) But thanks.
>>
>
> Yeah, I know. But look how easy - seductively easy. :)
>
> ---
>
> function LRNquery(tn, req, res) {
> sip.send({
> method: 'INVITE',
> uri: 'sip:' + tn + '@208.52.173.7:5062',
> version: '2.0',
> headers: {
> from: {
> name: 'node',
> uri: 'sip:node at 172.30.106.108:5060',
> params: { tag: 'abcxyz123444' }
> },
>
> to: {
> name: 'redirect',
> uri: 'sip:redirect at 208.52.173.7:5062',
> params: {}
> },
>
> 'call-id': '9995551232344523 at 172.30.106.108',
> cseq: { seq: 1, method: 'INVITE' },
> contact: [ {
> name: undefined,
> uri: 'sip:node at 172.30.106.108:5081',
> params: {}
> } ]
> }
> }, function(rs) {
> if(rs.status == 302 && 'headers' in rs && 'contact' in
> rs.headers &&
> rs.headers.contact.length > 0) {
> var contact = rs.headers.contact.shift();
>
> var lrn = contact.uri.match(/rn=(\d+)/);
>
> if(lrn) {
> res.writeHead(200, 'OK', {
> 'Content-Length': lrn[1].length
> });
>
> res.end(lrn[1]);
> return;
> }
> }
>
> res.writeHead(500, 'Internal Server Error');
> res.end();
> });
>
> }
>
> --
> Alex Balashov | Principal | Evariste Systems LLC
> 1447 Peachtree Street NE, Suite 700
> Atlanta, GA 30309
> United States
>
> Tel: +1-800-250-5920 (toll-free) / +1-678-954-0671 (direct)
> Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
--
Best regards,
Igor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20160330/e1874a41/attachment.html>
More information about the sr-users
mailing list