Re: [OpenSIPS-Users] Opensip as transaprent inbound proxy for asterisk
thx for the suggestion, but anything after the fact (what I mean is once gets into asterisk script or context), is no good. What I am trying to accomplish is to have asterisk pick the correct context base on the sippeers table. The only way asterisk will identify by is the user name in the URL (which most likely is the original ANI) or by the actual source IP address at the network layer. Other then messing around and try to modify the source code of asterisk, it probably will not work. I did came up with a work around where I use open sips to modify the username (the ANI) and then have asterisk put back the original ANI after it pick the correct context. I just thought if there is a cleaner way of doing it by having opensips somehow modify the source IP at the network layer. Or what I mean is that opensips will act like a transparent proxy where asterisk does not it exist and think that the call actually came from outside Anyhow thx. By the way do you know (on my new topic) why opensips stops update the location table in a few hours (I think) after inital boot? Or what would cause that? Thx! -- View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Opensip-as-transaprent-inbound-proxy-for-asterisk-tp7588047p7588081.html Sent from the OpenSIPS - Users mailing list archive at Nabble.com. ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Re: [OpenSIPS-Users] Opensip as transaprent inbound proxy for asterisk
thx for the help, if you like you can read my reply to Mike. -- View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Opensip-as-transaprent-inbound-proxy-for-asterisk-tp7588047p7588082.html Sent from the OpenSIPS - Users mailing list archive at Nabble.com. ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Re: [OpenSIPS-Users] Opensip as transaprent inbound proxy for asterisk
thx for the suggestion, I don't think asterisk reads the IP from any of the header or in any part of SIP message. I think asterisk read the IP from the IP at the network layer. anyhow, if you like you can read my reply to Mike. Thx again. Have you ever encounter the usr_loc module that stop updating the DB location table after few hours from initial boot? -- View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Opensip-as-transaprent-inbound-proxy-for-asterisk-tp7588047p7588083.html Sent from the OpenSIPS - Users mailing list archive at Nabble.com. ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Re: [OpenSIPS-Users] Opensip as transaprent inbound proxy for asterisk
I believe the suggestion is to: 1. Allow all calls from OpenSIPs to hit your dial plan (insecure=invite) 2. In the dial plan, check for the existence of a custom header, this customer header should be inserted by opensips to indicate the original IP (append_hf(X-Original-IP: $si);) 3. do something based on the original IP received. -Brett -- Brett Nemeroff Sent with Airmail On October 14, 2013 at 1:02:09 PM, bluerain (frank21...@yahoo.com) wrote: thx for the suggestion, I don't think asterisk reads the IP from any of the header or in any part of SIP message. I think asterisk read the IP from the IP at the network layer. anyhow, if you like you can read my reply to Mike. Thx again. Have you ever encounter the usr_loc module that stop updating the DB location table after few hours from initial boot? -- View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Opensip-as-transaprent-inbound-proxy-for-asterisk-tp7588047p7588083.html Sent from the OpenSIPS - Users mailing list archive at Nabble.com. ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Re: [OpenSIPS-Users] Opensip as transaprent inbound proxy for asterisk
check this resource http://www.opensips.org/Documentation/Script-CoreFunctions#toc43 2013/10/14 Brett Nemeroff br...@nemeroff.com I believe the suggestion is to: 1. Allow all calls from OpenSIPs to hit your dial plan (insecure=invite) 2. In the dial plan, check for the existence of a custom header, this customer header should be inserted by opensips to indicate the original IP (append_hf(X-Original-IP: $si);) 3. do something based on the original IP received. -Brett -- Brett Nemeroff Sent with Airmail http://airmailapp.info/tracking On October 14, 2013 at 1:02:09 PM, bluerain (frank21...@yahoo.com//frank21...@yahoo.com) wrote: thx for the suggestion, I don't think asterisk reads the IP from any of the header or in any part of SIP message. I think asterisk read the IP from the IP at the network layer. anyhow, if you like you can read my reply to Mike. Thx again. Have you ever encounter the usr_loc module that stop updating the DB location table after few hours from initial boot? -- View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Opensip-as-transaprent-inbound-proxy-for-asterisk-tp7588047p7588083.html Sent from the OpenSIPS - Users mailing list archive at Nabble.com. ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Re: [OpenSIPS-Users] Opensip as transaprent inbound proxy for asterisk
Hello, I'm use this procedure to know original IP (long way): first define a context on opensips trunk configurated on Asterisk., then I use this dialplan block: [opensip] exten = _X.,1,Set(uri=${CHANNEL(uri)}) same = n,Set(uri2=${CHANNEL(from)}) same = n,Set(uri=${CUT(uri,@,2)}) same = n,Set(uri=${CUT(uri,:,1)}) same = n,Gotoif($[${uri} = ]?fromuri) same = n,Gotoif($[${DB_EXISTS(ip/${uri})} = 0]?block) same = n,Goto(${DB(ip/${uri})},${EXTEN},1) same = n,Hangup same = n(fromuri),Set(uri=${CUT(uri2,@,2)}) same = n,Set(uri=${CUT(uri,:,1)}) same = n,Gotoif($[${DB_EXISTS(ip/${uri})} = 0]?block) same = n,Goto(${DB(ip/${uri})},${EXTEN},1) same = n,Hangup same = n(block),NoOP(bloqueo de IP) same = n,Hangup IF the IP is not present on contact header is present on from header. Then I created family key on internal Asterisk database with this sintax: IP 1.2.3.4 name Asterisk check if The IP is present on database and if true send the call to context name. From there you can use the dialplan you want. Regards. El 14/10/2013 13:02, bluerain escribió: thx for the suggestion, I don't think asterisk reads the IP from any of the header or in any part of SIP message. I think asterisk read the IP from the IP at the network layer. anyhow, if you like you can read my reply to Mike. Thx again. Have you ever encounter the usr_loc module that stop updating the DB location table after few hours from initial boot? -- View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Opensip-as-transaprent-inbound-proxy-for-asterisk-tp7588047p7588083.html Sent from the OpenSIPS - Users mailing list archive at Nabble.com. ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Re: [OpenSIPS-Users] Opensip as transaprent inbound proxy for asterisk
sorry, again, I am not looking for to know the source ip IN asterisk script. I need to direct the incoming call to different context within asterisk by the source IP. I DO NOT want to have 1 big context script in the extensions.conf. I want to be able to able to direct inbound call to different contexts base on the source IP address. This way I can be very flexible in providing different service to different customer (or IP address). And easier to manage then 1 BIG context. Having Opensips infront of asterisk killed this flexbility because to asterisk all call is coming from 1 IP address. -- View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Opensip-as-transaprent-inbound-proxy-for-asterisk-tp7588047p7588089.html Sent from the OpenSIPS - Users mailing list archive at Nabble.com. ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Re: [OpenSIPS-Users] Opensip as transaprent inbound proxy for asterisk
Yes, I know. But with that, I will end up with 1 HUGE context (script) in the extensions.conf. So if I have 10 different customer, I would have to have 1 HUGE context script to maintain. Vs. if I can direct differnet Inbound calls to different context from beginning then the script is much manageble. And also in the sippear there are many different setting I can set base on different customer. For example, if I want to be able turn on or off NAT for different inbound IPs, now with just 1 IP, I can no longer do it... -- View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Opensip-as-transaprent-inbound-proxy-for-asterisk-tp7588047p7588090.html Sent from the OpenSIPS - Users mailing list archive at Nabble.com. ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Re: [OpenSIPS-Users] Opensip as transaprent inbound proxy for asterisk
You do not need to manipulate core variables. You have to add a header to pass the source ip to asterisk. esample append_hf(X-src-ip: $si\r\n) Il 10/10/2013 02.05, bluerain ha scritto: Are you sure? Can you tell my which function call in opensips? I know how to manipulate the core variable, but $si is read only. And I think if you define a peering resource in asterisk, it will try to match it by the source IP at the network layer and not within the INVITE. Please tell me which function to manipulate in opensips and I can try. Thx -- View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Opensip-as-transaprent-inbound-proxy-for-asterisk-tp7588047p7588049.html Sent from the OpenSIPS - Users mailing list archive at Nabble.com. ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Re: [OpenSIPS-Users] Opensip as transaprent inbound proxy for asterisk
cool, thx for that, I will try it! Thank you very much for your help! -- View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Opensip-as-transaprent-inbound-proxy-for-asterisk-tp7588047p7588055.html Sent from the OpenSIPS - Users mailing list archive at Nabble.com. ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Re: [OpenSIPS-Users] Opensip as transaprent inbound proxy for asterisk
Just FYI, I tried, I insert your line in the method invite and right before the routing, Asterisk didn't seem to care. It still care about the prior Hop IP. So what I mean is that from 199.33.33.33 -- opensip 22.55.33.33 (and then I put your line) -- Asterisk server. Asterisk server identified the call came from 22.55.33.33 and not 199.33.33.33 Frank -- View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Opensip-as-transaprent-inbound-proxy-for-asterisk-tp7588047p7588062.html Sent from the OpenSIPS - Users mailing list archive at Nabble.com. ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Re: [OpenSIPS-Users] Opensip as transaprent inbound proxy for asterisk
the sugestion from Stefano is to you transport the ip information from opensips to asterisk, when you are in asterisk you get that variable and validate the customer, if just opensips will talk with asterisk so you dont need the ip address on asterisk, just in opensips, you made all validation on opensips, and send that with some kind of identification of the customer to asterisk, define as callerid or accountcode and make the next step on asterisk. I understand what you want, maybe you should try to use some kind of redirect, you send the call to opensips, opensips check which server should receive that and so you reply with a redirect message and the call will be stablished directly with the asterisk, opensips will just show the path 2013/10/10 bluerain frank21...@yahoo.com Just FYI, I tried, I insert your line in the method invite and right before the routing, Asterisk didn't seem to care. It still care about the prior Hop IP. So what I mean is that from 199.33.33.33 -- opensip 22.55.33.33 (and then I put your line) -- Asterisk server. Asterisk server identified the call came from 22.55.33.33 and not 199.33.33.33 Frank -- View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Opensip-as-transaprent-inbound-proxy-for-asterisk-tp7588047p7588062.html Sent from the OpenSIPS - Users mailing list archive at Nabble.com. ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Re: [OpenSIPS-Users] Opensip as transaprent inbound proxy for asterisk
Hi bluerain, Our production setup is using OpenSIPS as proxy to many Asterisk instances via load_balancer module. I can see from the SIP logs on our Asterisk servers the SIP headers sent from OpenSIPS to Asterisk still contains the original IP (From, Contact, and the bottom one Via) Have you tried to read any of those SIP header in your Asterisk script? You should also check your opensips script in /etc/opensips/opensips.cfg to see if you have rewrite SIP headers which contain the original ip. Cheers, Bruce On Fri, Oct 11, 2013 at 11:38 AM, Mike Tesliuk m...@ultra.net.br wrote: the sugestion from Stefano is to you transport the ip information from opensips to asterisk, when you are in asterisk you get that variable and validate the customer, if just opensips will talk with asterisk so you dont need the ip address on asterisk, just in opensips, you made all validation on opensips, and send that with some kind of identification of the customer to asterisk, define as callerid or accountcode and make the next step on asterisk. I understand what you want, maybe you should try to use some kind of redirect, you send the call to opensips, opensips check which server should receive that and so you reply with a redirect message and the call will be stablished directly with the asterisk, opensips will just show the path 2013/10/10 bluerain frank21...@yahoo.com Just FYI, I tried, I insert your line in the method invite and right before the routing, Asterisk didn't seem to care. It still care about the prior Hop IP. So what I mean is that from 199.33.33.33 -- opensip 22.55.33.33 (and then I put your line) -- Asterisk server. Asterisk server identified the call came from 22.55.33.33 and not 199.33.33.33 Frank -- View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Opensip-as-transaprent-inbound-proxy-for-asterisk-tp7588047p7588062.html Sent from the OpenSIPS - Users mailing list archive at Nabble.com. ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users -- simple is good http://brucewang.net http://twitter.com/number5 ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Re: [OpenSIPS-Users] Opensip as transaprent inbound proxy for asterisk
Just FYI you need to write down some code in asterisk to manage the new header obviusly Il 11/10/2013 02.30, bluerain ha scritto: Just FYI, I tried, I insert your line in the method invite and right before the routing, Asterisk didn't seem to care. It still care about the prior Hop IP. So what I mean is that from 199.33.33.33 -- opensip 22.55.33.33 (and then I put your line) -- Asterisk server. Asterisk server identified the call came from 22.55.33.33 and not 199.33.33.33 Frank -- View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Opensip-as-transaprent-inbound-proxy-for-asterisk-tp7588047p7588062.html Sent from the OpenSIPS - Users mailing list archive at Nabble.com. ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
[OpenSIPS-Users] Opensip as transaprent inbound proxy for asterisk
I've try to search on internet but not much info. I currently have Asterisk server setup to have sip trunk with customers on a peer type. This way, no registration need and that asterisk server will identify the inbound call base on IP address matching. But now I would like to put OPENSIPS in front of asterisk server (so I can load balance). But once I do that, asterisk loses the capability of getting the original source IP. All the call from different customer now only have OPENSIPS server IP address. $si is not ediable. It seems asterisk server read source IP at a higher layer ( I am no network guru so pardon my stupid language). Is this something I have to tackle at the OS level and not at OpenSIP leve? Opensips only manipulate sip message where as asterisk is reading the source IP at the network layer? Or is there something Opensips can do? Or can someone point me to a software (prefer open source) that would make Debian a transparent proxy? I've search for that but mostly come up with 'SQUID' which is a transparent HTTP server, I don't think that is for sip protocol. Thank you! -- View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Opensip-as-transaprent-inbound-proxy-for-asterisk-tp7588047.html Sent from the OpenSIPS - Users mailing list archive at Nabble.com. ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Re: [OpenSIPS-Users] Opensip as transaprent inbound proxy for asterisk
opensips can add an header with the real IP and asterisk can use that header to know the real IP Il 09/10/2013 17.02, bluerain ha scritto: I've try to search on internet but not much info. I currently have Asterisk server setup to have sip trunk with customers on a peer type. This way, no registration need and that asterisk server will identify the inbound call base on IP address matching. But now I would like to put OPENSIPS in front of asterisk server (so I can load balance). But once I do that, asterisk loses the capability of getting the original source IP. All the call from different customer now only have OPENSIPS server IP address. $si is not ediable. It seems asterisk server read source IP at a higher layer ( I am no network guru so pardon my stupid language). Is this something I have to tackle at the OS level and not at OpenSIP leve? Opensips only manipulate sip message where as asterisk is reading the source IP at the network layer? Or is there something Opensips can do? Or can someone point me to a software (prefer open source) that would make Debian a transparent proxy? I've search for that but mostly come up with 'SQUID' which is a transparent HTTP server, I don't think that is for sip protocol. Thank you! -- View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Opensip-as-transaprent-inbound-proxy-for-asterisk-tp7588047.html Sent from the OpenSIPS - Users mailing list archive at Nabble.com. ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Re: [OpenSIPS-Users] Opensip as transaprent inbound proxy for asterisk
Are you sure? Can you tell my which function call in opensips? I know how to manipulate the core variable, but $si is read only. And I think if you define a peering resource in asterisk, it will try to match it by the source IP at the network layer and not within the INVITE. Please tell me which function to manipulate in opensips and I can try. Thx -- View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Opensip-as-transaprent-inbound-proxy-for-asterisk-tp7588047p7588049.html Sent from the OpenSIPS - Users mailing list archive at Nabble.com. ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users