Re: [OpenSIPS-Users] Run custom PHP script to send SMS upon receiving invite

2010-07-24 Thread Laszlo
Sounds like a bad idea :)

You can try to play with the exec module, see
http://www.opensips.org/html/docs/modules/1.6.x/exec.html

-Laszlo


2010/7/24 Nauman Sulaiman nauman762-h...@yahoo.co.uk

 Hi, using OpenSIPs 1.6, how does one run a custom php script (or whatever
 code) upon
 receiving incoming INVITE. We need to perform some custom action ie send
 SMS message
 when receiving an INVITE. With asterisk one can use the System function in
 DialPlan
 what is the equivalent way with OpensSIPS.

 Thanks


 ___
 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] Run custom PHP script to send SMS upon receiving invite

2010-07-24 Thread Brett Nemeroff
The exec module has a huge performance penalty. I'd avoid it if high
performance is required. I don't know anything about your application, but
if the time delay between the invite and the SMS isn't too sensitive, you
could consider using avp_db_query to insert a queued notification to a SMS
message.

Alternatively, you could use avp_db_query with db_http to post a realtime
SMS notification, but you'd need to create a db adapter per db_http; it
shouldn't be too hard at all. The perl module is also very good, but I'm not
sure how up-to-date it is.

-Brett



On Sat, Jul 24, 2010 at 7:48 AM, Laszlo las...@voipfreak.net wrote:

 Sounds like a bad idea :)

 You can try to play with the exec module, see
 http://www.opensips.org/html/docs/modules/1.6.x/exec.html

 -Laszlo


 2010/7/24 Nauman Sulaiman nauman762-h...@yahoo.co.uk

  Hi, using OpenSIPs 1.6, how does one run a custom php script (or
 whatever code) upon
 receiving incoming INVITE. We need to perform some custom action ie send
 SMS message
 when receiving an INVITE. With asterisk one can use the System function in
 DialPlan
 what is the equivalent way with OpensSIPS.

 Thanks


 ___
 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] Run custom PHP script to send SMS upon receiving invite

2010-07-24 Thread Nauman Sulaiman
Thank you for the respnses

--- On Sat, 24/7/10, Brett Nemeroff br...@nemeroff.com wrote:

From: Brett Nemeroff br...@nemeroff.com
Subject: Re: [OpenSIPS-Users] Run custom PHP script to send SMS upon receiving 
invite
To: OpenSIPS users mailling list users@lists.opensips.org
Date: Saturday, 24 July, 2010, 15:59

The exec module has a huge performance penalty. I'd avoid it if high 
performance is required. I don't know anything about your application, but if 
the time delay between the invite and the SMS isn't too sensitive, you could 
consider using avp_db_query to insert a queued notification to a SMS message.


Alternatively, you could use avp_db_query with db_http to post a realtime SMS 
notification, but you'd need to create a db adapter per db_http; it shouldn't 
be too hard at all. The perl module is also very good, but I'm not sure how 
up-to-date it is. 


-Brett


On Sat, Jul 24, 2010 at 7:48 AM, Laszlo las...@voipfreak.net wrote:


Sounds like a bad idea :)

You can try to play with the exec module, see 
http://www.opensips.org/html/docs/modules/1.6.x/exec.html



-Laszlo




2010/7/24 Nauman Sulaiman nauman762-h...@yahoo.co.uk




Hi, using OpenSIPs 1.6, how does one run a custom php script (or whatever code) 
uponreceiving incoming INVITE. We need to perform some custom action ie send 
SMS message



when receiving an INVITE. With asterisk one can use the System function in 
DialPlanwhat is the equivalent way with OpensSIPS.
Thanks 




  
___

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





-Inline Attachment Follows-

___
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] Opensips as outbound proxy for asterisk client

2010-07-24 Thread Nauman Sulaiman
Hi, We have Asterisk 1.6.2.9 and Opensips 1.6.2 in the same Linux box and we 
want 
to have OpenSIPS as the out/inbound proxy for Asterisk when running as UAC. 

We have Asterisk registered with Sipgate ok when sending REGISTER directly to 
the Sipgate
domain but would like to send the Register via OpenSIPS so it's in the path for 
incoming invites

Opensips.cfg as follows

listen=udp:192.168.0.20:5060

register code: we have removed the authentication for now to get this working 
first

 if (is_method(REGISTER))
    {

   if (!db_check_to())
   {
    sl_send_reply(403,Forbidden auth ID);
    exit;
   }

    if (!save(location))
    sl_reply_error();

    exit;
    }




we have astersik sip.conf file as follows

[general]
port=5062
bindaddr=0.0.0.0
context=default
outboundproxy=192.168.0.20
outboundproxyport=5060

register = username:sec...@sipgate.co.uk/username

[username]
type=friend
context=incoming
username=username
secret=secret
host=sipgate.co.uk
host=dynamic
fromdomain=sipgate.co.uk
insecure=port,invite
nat=yes
disallow=all
allow=alaw
canreinvite=no

However the REGISTER messages are sent by Astersik but ther is no response fron 
OpenSIPS and it is not routing them either . Is it because they are both on the 
same IP?
We do have then on different ports so though it would be ok




  ___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Run custom PHP script to send SMS upon receiving invite

2010-07-24 Thread Laszlo
Brett is right, but avp_db_query can be a performance killer too (just
imagine it with 200 new calls per second = 200 insert queries/sec)

-Laszlo

2010/7/24 Nauman Sulaiman nauman762-h...@yahoo.co.uk

 Thank you for the respnses

 --- On *Sat, 24/7/10, Brett Nemeroff br...@nemeroff.com* wrote:


 From: Brett Nemeroff br...@nemeroff.com
 Subject: Re: [OpenSIPS-Users] Run custom PHP script to send SMS upon
 receiving invite
 To: OpenSIPS users mailling list users@lists.opensips.org
 Date: Saturday, 24 July, 2010, 15:59

 The exec module has a huge performance penalty. I'd avoid it if high
 performance is required. I don't know anything about your application, but
 if the time delay between the invite and the SMS isn't too sensitive, you
 could consider using avp_db_query to insert a queued notification to a SMS
 message.

 Alternatively, you could use avp_db_query with db_http to post a realtime
 SMS notification, but you'd need to create a db adapter per db_http; it
 shouldn't be too hard at all. The perl module is also very good, but I'm not
 sure how up-to-date it is.

 -Brett



 On Sat, Jul 24, 2010 at 7:48 AM, Laszlo 
 las...@voipfreak.nethttp://mc/compose?to=las...@voipfreak.net
  wrote:

 Sounds like a bad idea :)

 You can try to play with the exec module, see
 http://www.opensips.org/html/docs/modules/1.6.x/exec.html

 -Laszlo


 2010/7/24 Nauman Sulaiman 
 nauman762-h...@yahoo.co.ukhttp://mc/compose?to=nauman762-h...@yahoo.co.uk
 

  Hi, using OpenSIPs 1.6, how does one run a custom php script (or
 whatever code) upon
 receiving incoming INVITE. We need to perform some custom action ie send
 SMS message
 when receiving an INVITE. With asterisk one can use the System function
 in DialPlan
 what is the equivalent way with OpensSIPS.

 Thanks


 ___
 Users mailing list
 Users@lists.opensips.org http://mc/compose?to=us...@lists.opensips.org
 http://lists.opensips.org/cgi-bin/mailman/listinfo/users



 ___
 Users mailing list
 Users@lists.opensips.org http://mc/compose?to=us...@lists.opensips.org
 http://lists.opensips.org/cgi-bin/mailman/listinfo/users



 -Inline Attachment Follows-


 ___
 Users mailing list
 Users@lists.opensips.org http://mc/compose?to=us...@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] Opensips as outbound proxy for asterisk client

2010-07-24 Thread Laszlo
You can relay the register to sipgate, so when auth is done, then you can
forward it.

consume_credentials();
$du = sip:sipgate_ip_goes_here:port;
t_relay();
exit;

so instead of doing if (!save(location))   etc


-Laszlo


2010/7/24 Nauman Sulaiman nauman762-h...@yahoo.co.uk

 Hi, We have Asterisk 1.6.2.9 and Opensips 1.6.2 in the same Linux box and
 we want
 to have OpenSIPS as the out/inbound proxy for Asterisk when running as UAC.


 We have Asterisk registered with Sipgate ok when sending REGISTER directly
 to the Sipgate
 domain but would like to send the Register via OpenSIPS so it's in the path
 for incoming invites

 Opensips.cfg as follows

 listen=udp:192.168.0.20:5060

 register code: we have removed the authentication for now to get this
 working first

  if (is_method(REGISTER))
 {

if (!db_check_to())
{
 sl_send_reply(403,Forbidden auth ID);
 exit;
}

 if (!save(location))
 sl_reply_error();

 exit;
 }




 we have astersik sip.conf file as follows

 [general]
 port=5062
 bindaddr=0.0.0.0
 context=default
 outboundproxy=192.168.0.20
 outboundproxyport=5060

 register = username:sec...@sipgate.co.uk/username

 [username]
 type=friend
 context=incoming
 username=username
 secret=secret
 host=sipgate.co.uk
 host=dynamic
 fromdomain=sipgate.co.uk
 insecure=port,invite
 nat=yes
 disallow=all
 allow=alaw
 canreinvite=no

 However the REGISTER messages are sent by Astersik but ther is no response
 fron OpenSIPS and it is not routing them either . Is it because they are
 both on the same IP?
 We do have then on different ports so though it would be ok



 ___
 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] Opensips as outbound proxy for asterisk client

2010-07-24 Thread Nauman Sulaiman
Hi, many thanks

 we don't follow this line

$du = sip:sipgate_ip_goes_here:port

where do we get the sipgate ip, should this just be

$du = sip:sipgate.co.uk:5060

at least it explains why we saw the REGISTER being gobbled


--- On Sat, 24/7/10, Laszlo las...@voipfreak.net wrote:

From: Laszlo las...@voipfreak.net
Subject: Re: [OpenSIPS-Users] Opensips as outbound proxy for asterisk client
To: nauman762-h...@yahoo.co.uk, OpenSIPS users mailling list 
users@lists.opensips.org
Date: Saturday, 24 July, 2010, 19:28

You can relay the register to sipgate, so when auth is done, then you can 
forward it.

consume_credentials();
$du = sip:sipgate_ip_goes_here:port;
t_relay();
exit;

so instead of doing if (!save(location))   etc




-Laszlo


2010/7/24 Nauman Sulaiman nauman762-h...@yahoo.co.uk


Hi, We have Asterisk 1.6.2.9 and Opensips 1.6.2 in the same Linux box and we 
want 
to have OpenSIPS as the out/inbound proxy for Asterisk when running as UAC. 



We have Asterisk registered with Sipgate ok when sending REGISTER directly to 
the Sipgate
domain but would like to send the Register via OpenSIPS so it's in the path for 
incoming invites

Opensips.cfg as follows



listen=udp:192.168.0.20:5060

register code: we have removed the authentication for now to get this working 
first

 if (is_method(REGISTER))


    {

   if (!db_check_to())
   {
   
 sl_send_reply(403,Forbidden auth ID);
    exit;
   }

    if (!save(location))
    sl_reply_error();

    exit;


    }




we have astersik sip.conf file as follows

[general]
port=5062
bindaddr=0.0.0.0
context=default
outboundproxy=192.168.0.20
outboundproxyport=5060

register =
 username:sec...@sipgate.co.uk/username

[username]
type=friend
context=incoming
username=username
secret=secret
host=sipgate.co.uk


host=dynamic
fromdomain=sipgate.co.uk
insecure=port,invite
nat=yes
disallow=all
allow=alaw
canreinvite=no

However the REGISTER messages are sent by Astersik but ther is no response fron 
OpenSIPS and it is not routing them either . Is it because they are both on the 
same IP?


We do have then on different ports so though it would be ok






  
___

Users mailing list

Users@lists.opensips.org

http://lists.opensips.org/cgi-bin/mailman/listinfo/users



#yiv373057038 #avg_ls_inline_popup {padding:0px 
0px;margin-left:0px;margin-top:0px;width:240px;overflow:hidden;word-wrap:break-word;color:black;font-size:10px;text-align:left;line-height:13px;}



  ___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Mediaproxy not updating with new SDPs

2010-07-24 Thread Richard Revels
Saul (and everyone) good afternoon.

I think I've come across a call flow that Mediaproxy would be expected to 
handle but is not.  Umm, it's like sacrilege I know; but I think Mediaproxy may 
have a bug.

1) The originator sends INVITE with a couple of codec choices.
2) engage_media proxy is called and the INVITE is forwarded
3) 200 comes back with a couple of codec choices and m line indicates rtp will 
source from port 35210 (and indeed rtp starts sourcing from there
4) The ACK comes back and for 10 milliseconds life is good

Then the Originator reinvites with only the single codec choice that it 
believes was negotiated.  Standard procedure for this device and allowed and 
all that but really, 10 milliseconds?? Anyway...

5) reinvite is forwarded without any mediaproxy calls or anything from the 
script
6) The destination sends back a 200 but this time claims it will source from 
port 1082.
7) The destination rtp continues to source from the original port 35210

So, the result here is that rtp comes from the origination and is forwarded, by 
Mediaproxy, to port 35210 at the destination where it is happily accepted.  
Media also flows from the destination from port 35210 but it is not forwarded 
which results in one way audio on the call.

It will be Monday before I am able to request more calls to be made but I'm 
kind of thinking the firewall may be the cause of the port not changing and the 
UA is actually sending from a new port.  Maybe not though.  

In either case, should the Mediaproxy have waited for a rtp packet on any port 
from the (call) destination IP after the 200 to the reinvite and set a new 
connection track rule after it saw one?

I'm using Mediaproxy 2.4.2.

Richard



On Jul 21, 2010, at 5:14 PM, Saúl Ibarra Corretgé wrote:

 Hi Jeff,
 
 On 21/07/10 21:50, Jeff Pyle wrote:
 Hello,
 
 I am using Mediaproxy 2.3.8 with Opensips 1.6 r6702.  I use the 
 engage_media_proxy() function.  Most things work pretty well except for the 
 following scenario:
 
 Call comes in from CPE, hits the engage_media_proxy() function, and 
 t_relay's to the far end.  The far-end sends a 503, but before they do, they 
 send some media.  I'm working with them now to determine the true source of 
 this unwanted media.  Anyway, Opensips does a serial fork to the next 
 carrier, who sends a 183 w/ SDP, and finally a 200 OK.  But the media relay 
 has already locked down to the media the first carrier sent.  How come the 
 media relay doesn't learn about the new media information from the SDPs in 
 the 183 and the 200?
 
 
 MediaProxy uses the information from the SDP from both ends and then it 
 waits to receive a RTP packet from each endpoint. Once this happens it 
 inserts a conntrack rule in the kernel so that the relaying is performed.
 
 I could judge better with a SIP trace but my guess is that the dialog 
 could get to an inconsistent state, so mediaproxy loses track.
 
 I'd like to be able to wait for an SDP to come back on a 18x or a 200 before 
 starting the relay.  It appears the engage_media_proxy() function is 
 available only from the REQUEST_ROUTE.  Perhaps it would be smarter in this 
 case to use the use_media_proxy()/end_media_session() functions in the 
 REPLY_ROUTE and FAILURE_ROUTEs.
 
 
 You are right. Engage_media_proxy covers most general purpose scenarios 
 but it's not suitable for everyone, so in this case you may want yo call 
 the individual functions manually.
 
 
 Regards,
 
 -- 
 Saúl Ibarra Corretgé
 AG Projects
 
 ___
 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] Opensips as outbound proxy for asterisk client

2010-07-24 Thread Nauman Sulaiman
Hi, making progress

we now have this so the REGISTER is passed to the Sipgate proxy transparently 
it could be any proxy server so 

 if (is_method(REGISTER))
    {
 
 ##$du = sip:sipgate.co.uk:5060;
 t_relay();
  exit();
 }

We can see via Wireshark trace that REGISTER is reaching the sipgate proxy but 
OpenSIPS is returning a 403 to our Asterisk (acting as the SIP client)

its because of this code, so then upon receiving the 403 from Opensips it 
doesn't respond to the 401 from the sipgate proxy. What should we be doing below

if (!is_uri_host_local())
    {
    if(is_from_local()) {
 route(1);
 }
 else {
  sl_send_reply(403,Not here);
   }

    ##append_hf(P-hint: outbound\r\n);
    # if you have some interdomain connections via TLS
    ##if($rd==tls_domain1.net) {
    ##  t_relay(tls:domain1.net);
    ##  exit;
    ##} else if($rd==tls_domain2.net) {
    ##  t_relay(tls:domain2.net);
    ##  exit;
    ##}
    ##route(1);
    }

Thanks

--- On Sat, 24/7/10, Nauman Sulaiman nauman762-h...@yahoo.co.uk wrote:

From: Nauman Sulaiman nauman762-h...@yahoo.co.uk
Subject: Re: [OpenSIPS-Users] Opensips as outbound proxy for asterisk client
To: OpenSIPS users mailling list users@lists.opensips.org, Laszlo 
las...@voipfreak.net
Date: Saturday, 24 July, 2010, 19:48

Hi, many thanks

 we don't follow this line

$du = sip:sipgate_ip_goes_here:port

where do we get the sipgate ip, should this just be

$du = sip:sipgate.co.uk:5060

at least it explains why we saw the REGISTER being gobbled


--- On Sat, 24/7/10, Laszlo las...@voipfreak.net wrote:

From: Laszlo las...@voipfreak.net
Subject: Re: [OpenSIPS-Users] Opensips as outbound proxy for asterisk client
To: nauman762-h...@yahoo.co.uk, OpenSIPS users mailling list 
users@lists.opensips.org
Date: Saturday, 24 July, 2010, 19:28

You can relay the register to sipgate, so when auth is done, then you can 
forward it.

consume_credentials();
$du =
 sip:sipgate_ip_goes_here:port;
t_relay();
exit;

so instead of doing if (!save(location))   etc




-Laszlo


2010/7/24 Nauman Sulaiman nauman762-h...@yahoo.co.uk


Hi, We have Asterisk 1.6.2.9 and Opensips 1.6.2 in the same Linux box and we 
want 
to have OpenSIPS as the out/inbound proxy for Asterisk when running as UAC. 



We have Asterisk registered with Sipgate ok when sending REGISTER directly to 
the Sipgate
domain but would like to send the Register via OpenSIPS so it's in the path for 
incoming invites

Opensips.cfg as follows



listen=udp:192.168.0.20:5060

register code: we have removed the authentication for now to get this working 
first

 if (is_method(REGISTER))


    {

   if (!db_check_to())
   {
   
 sl_send_reply(403,Forbidden auth ID);
    exit;
   }

    if (!save(location))
    sl_reply_error();

    exit;


    }




we have astersik sip.conf file as follows

[general]
port=5062
bindaddr=0.0.0.0
context=default
outboundproxy=192.168.0.20
outboundproxyport=5060

register =
 username:sec...@sipgate.co.uk/username

[username]
type=friend
context=incoming
username=username
secret=secret
host=sipgate.co.uk


host=dynamic
fromdomain=sipgate.co.uk
insecure=port,invite
nat=yes
disallow=all
allow=alaw
canreinvite=no

However the REGISTER messages are sent by Astersik but ther is no response fron 
OpenSIPS and it is not routing them either . Is it because they are both on the 
same IP?


We do have then on different ports so though it would be ok






  
___

Users mailing list

Users@lists.opensips.org

http://lists.opensips.org/cgi-bin/mailman/listinfo/users



#yiv363631247 #yiv373057038 #avg_ls_inline_popup {padding:0px 
0px;margin-left:0px;margin-top:0px;width:240px;overflow:hidden;word-wrap:break-word;color:black;font-size:10px;text-align:left;line-height:13px;}





  
-Inline Attachment Follows-

___
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] DNS issues

2010-07-24 Thread Stanisław Pitucha
Hi all,

I wanted to collect some ideas on how do you solve DNS connectivity
problems. I've run into those issues a couple of times already and don't
see a perfect solution so far. Maybe I can trigger some discussion:

Some background:
- opensips blocks the child process while resolving a domain / querying ENUM
- standard resolver has minimum timeout = 1s
- standard resolver does only one query at a time and can cycle
nameservers, but does not save state
I believe these are not real problems - just ugly legacy :) that we can
work around.

The implication is that if you don't use a caching nameserver on your
side and you allow users to use routing based on a domain name (not very
hard - do you handle 302s, record-routes, registration?), you're
basically screwed:

1. If you don't cache, any domain which times out will block a child for
at least 1s. If you use retries, you block for at least Ns where N =
number of nameservers. You can be DoS-ed with ~8 packets per second, in
standard configuration.

2. If you cycle N nameservers and one of them is down, you're processing
N-1 packets correctly, then block until timeout on the last one, then
processing N-1, etc. - not good for a high-traffic proxy.

3. If you cache results, you're safe from random failures, but only if
you cache timeouts as negative results and keep the state of servers
being down, so you don't try to query them again. (nothing apart from
`dnsmasq` does that, AFAIK)

4. What solves half of the problem for me, is `dnsmasq` - as far as I
know it's the only caching dns server which allows to query all
nameservers in parallel. I get 4 times the needed DNS traffic, but I'm
never timing out connections if one of the servers is down. Also some
results come from cache, so it's only 2 times the traffic in reality.
The problem with `dnsmasq` is that it doesn't cache SRV and NAPTR
requests (doesn't cache the timeouts / NX responses for them either),
only A//PTR/

5. So even if you have a local caching and backup resolver in
`resolv.conf`, minimal timeout, parallel querying from the local cache,
saving the state of upstream resolvers being down and route all internal
traffic via IPs... it takes only one person with custom NAPTR sending
you to custom SRV address which times out to kill all the traffic.

So... what's your experience with this? Do you have some better
protection in place?
I'm considering adding negative caching of dns timeouts and general
caching of SRV and NAPTR records into `dnsmasq` to complete my protection.
Do you know of any software which would solve those problems out-of-box?

Thanks,
Stan

___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users