Re: [OpenSIPS-Users] How to send SIP header 302 registration request to Asterisk
Hello Ahmed! Use rewritehost() and send 302 reply to user, I am using permission module and redirecting to zz.zz.zz.zz. ip if authenticated by permission module. if (check_source_address(1,$avp(i:9))) { xlog(L_INFO,GW sends INVITE and was found in DB: $avp(i:9)\n); xlog(L_INFO,from user- $ru\n); rewritehost(zz.zz.zz.zz); sl_send_reply(302, Redirect); exit; } Thanks Regards Muhammad Zulqarnain Re: [OpenSIPS-Users] How to send SIP header 302 registration request to Asterisk Friday, December 18, 2009 2:22:26 PM From: Ahmed Munir ahmedmunir...@gmail.com To: users@lists.opensips.org Hi, Thanks for your reply, I'm attaching the file named trace. Where OpenSIPs IP is: yy.yy.yy.yy, Asterisk IP: zz.zz.zz.zz and my UAC IP: xx.xx.xx.xx. As you can see I'm getting unauthourized error from Asterisk side, even using these credentials I can get registered on my Asterisk machine Previously I forgot to ask, how can I set SIP header 302 on registeration section in OpenSIPs? Kindly advise me. Date: Thu, 17 Dec 2009 22:40:15 -0800 From: Jai Rangi jpra...@gmail.com Subject: Re: [OpenSIPS-Users] How to send SIP header 302 registration request to Asterisk To: OpenSIPS users mailling list users@lists.opensips.org Message-ID: eb007ec0912172240hc779cbflbf3460b835f1f...@mail.gmail.com Content-Type: text/plain; charset=iso-8859-1 Getting some ngrep traces will help some other to help you. Unauthorized message is for useraccount or for opensip. -Jai On Thu, Dec 17, 2009 at 10:25 PM, Ahmed Munir ahmedmunir...@gmail.comwrote: Hi, I'm using OpenSIPs version 1.6, the module I'm using is dispatcher using mysql. My question is how can I send SIP header 302 registration request to Asterisk? Because Asterisk is sending me unAuthorized message to OpenSIPs. Even the credentials I'm using for Asterisk is the same as I'm using for OpenSIPs. Kindly advise me to resolve this issue. -- Regards, Ahmed Munir ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users -- next part -- An HTML attachment was scrubbed... URL: http://lists.opensips.org/pipermail/users/attachments/20091217/2c123ff7/attachment-0001.htm -- -- Regards, Ahmed Munir ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Re: [OpenSIPS-Users] IP Based Authentication on Asterisk with OpenSIP (Bogdan-Andrei Iancu)
Hello! Thanks Bodgan! I have added following to sip header which add source IP in sip packet before sending to asterisk. append_hf(X-customer-ip: $si\r\n); Sip trace got following packet which add X-customer-ip: x.x.x.x to sip header but I am wondering how to told/setup asterisk to read source IP from additional sip header instead of network level. Also I have another switch named Voipswitch on which I would not be able to customize any thing to honor incoming sip header for source ip validation so solution should work for all GW/Server other then asterisk only. U 2009/12/12 18:58:32.829652 y.y.y.y:5060 - z.z.z.z:5060 INVITE sip:123456...@y.y.y.y SIP/2.0. Record-Route: sip:y.y.y.y;lr;ftag=a16f2b41;did=882.11d0f5f. To: sip:123456...@y.y.y.y. From: hellosip:he...@y.y.y.y;tag=a16f2b41. Via: SIP/2.0/UDP y.y.y.y;branch=z9hG4bKfb2e.a79595a4.0. Via: SIP/2.0/UDP x.x.x.x:7266;received=x.x.x.x;branch=z9hG4bK-d87543-197592634-1--d87543-;rport=7266. Call-ID: 9867b13bdc3a4f30. CSeq: 1 INVITE. Contact: sip:he...@x.x.x.x:7266. Max-Forwards: 69. Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO. Content-Type: application/sdp. User-Agent: eyeBeam release 3007n stamp 17816. Content-Length: 237. X-customer-ip: x.x.x.x. Please suggest solution with sample configs. Thanks Regards Muhammad Zulqarnain Hi Muhammad, What you can do (and I know for sure it works with Asterisk), is to configure opensips (LB) to add the real src IP (IP of the client) into a SIP header (in the request) and send it to Asterisk - asterisk will do IP based auth but will take IP from that header (custom name) instead of taking it from network level. Regards, Bogdan Muhammad Zulqarnain wrote: Hello! This is Zulqarnain and my first post to this mailing list. I just start using OpenSIP and trying to get myself familiar with OpenSIP and it's config files, method etc. Well, I am trying to achieve following: Client IP: x.x.x.x OpenSIP: y.y.y.y Asterisk: z.z.z.z 1) Client - OpenSIP (Load_balancer) - Asterisk1, Asterisk2 a) If Client Request is Register - Relay to Asterisk (It is working fine as peer is defined with user/passwd auth, host=dynamic) b) If Client Request is INVITE - Relay to Asterisk (Asterisk Reject as peer is defined as IP Auth, type=peer, host=x.x.x.x) b scenario failed as Asterisk read OpenSIP IP y.y.y.y and reject the call as Asterisk is expecting Source IP x.x.x.x instead of y.y.y.y I tried following to fix but no success: 1) 302 Redirect for GW Clients, who can only authenticate by IP and don't support registration with user/passwd. But my DID Provider don't support 302 redirect although i have tested with Eyebeam Client in peer to peer mode and it works. But as it didn't work with my provider so I tried another way: 2) uac_replace_from uac_replace_to function of uac.so module, I tried to replace from/to field with client IP but still Invite is from OpenSIP IP y.y.y.y and again Asterisk/Voipswitch (another switch) reject call. If required I can post my config file as well here or pastebin for your expert reviews. I would like to know if it is possible to achive above scenario with OpenSIP, if Yes then how, any example would appreciated. Another small problem is that while setting up 302 redirect I wanted to pass $du value to rewritehost() as $du have the address return by load_balancer of destination IP and rewritehost() only accept string. Looking for suggestion on this as well. Hopefully to receive positive reply by community. Thanks Regards, Muhammad Zulqarnain MSN: zulqarn...@globalitvision.com ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users -- Bogdan-Andrei Iancu www.voice-system.ro ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
[OpenSIPS-Users] IP Based Authentication on Asterisk with OpenSIP
Hello! This is Zulqarnain and my first post to this mailing list. I just start using OpenSIP and trying to get myself familiar with OpenSIP and it's config files, method etc. Well, I am trying to achieve following: Client IP: x.x.x.x OpenSIP: y.y.y.y Asterisk: z.z.z.z 1) Client - OpenSIP (Load_balancer) - Asterisk1, Asterisk2 a) If Client Request is Register - Relay to Asterisk (It is working fine as peer is defined with user/passwd auth, host=dynamic) b) If Client Request is INVITE - Relay to Asterisk (Asterisk Reject as peer is defined as IP Auth, type=peer, host=x.x.x.x) b scenario failed as Asterisk read OpenSIP IP y.y.y.y and reject the call as Asterisk is expecting Source IP x.x.x.x instead of y.y.y.y I tried following to fix but no success: 1) 302 Redirect for GW Clients, who can only authenticate by IP and don't support registration with user/passwd. But my DID Provider don't support 302 redirect although i have tested with Eyebeam Client in peer to peer mode and it works. But as it didn't work with my provider so I tried another way: 2) uac_replace_from uac_replace_to function of uac.so module, I tried to replace from/to field with client IP but still Invite is from OpenSIP IP y.y.y.y and again Asterisk/Voipswitch (another switch) reject call. If required I can post my config file as well here or pastebin for your expert reviews. I would like to know if it is possible to achive above scenario with OpenSIP, if Yes then how, any example would appreciated. Another small problem is that while setting up 302 redirect I wanted to pass $du value to rewritehost() as $du have the address return by load_balancer of destination IP and rewritehost() only accept string. Looking for suggestion on this as well. Hopefully to receive positive reply by community. Thanks Regards, Muhammad Zulqarnain MSN: zulqarn...@globalitvision.com ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users