Sending 180 Reply for incoming 183 Early media

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Sending 180 Reply for incoming 183 Early media

Thomas Gelf
Hi all,

there has been some rumor on IRC regarding this request, and as I do not
longer want to spend time on explaining details again and again I took
some time to write an example code doing exactly what Zizolazizo and
CK_28 wanted to achieve.

Please note: I didn't even test the code, it did never send even one
single SIP packet - I have absolutely no idea whether it will work as
expected. I will try to do some test this evening and let you know the
result.

As there are people insisting on their right for free support (where is
my free beer???) and as they are not stopping to stress and beg each guy
on IRC: here you go, get my maybe-working-script - and please stop
stressing busy people for some hour ;-p

Here an example on how to implement it:

---
loadmodule "textops.so"
loadmodule "perl.so"
modparam("perl", "filename", "/etc/opensips/perlfunctions.pl")

onreply_route[1]
{
    ...
    if(t_check_status("183")) {
        strip_body();
        perl_exec("sendReplyAs180");
        drop();
    }
}
---

Suggestions for improvements are welcome. Btw: what about implementing a
Status-mangling-function in OpenSIPS itself?

Cheers,
Thomas Gelf

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

perlfunctions.pl (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Sending 180 Reply for incoming 183 Early media (instead of)

Thomas Gelf
As expected I had to do some fixes and small changes:

- ReUse option ist required when sharing port 5060 with OpenSIPS
- some oversights ($m / $message, not passing $ip and $port etc)
- CRLF line after header
- strip_body() doesn't work for replies (even if you put it in a
  different route it will not work)

Some more notes:
- removing topmost Via, re-adding the other ones line by line (even
  if there have been multiple Via's on a single line)
- getting ip and port from the next-topmost Via, with respect to
  "rport" and "received" params
- removing all Content-* header lines
- adding Content-Length: 0
- obviously sending no body

You have to use it as follows:

---
loadmodule "perl.so"
modparam("perl", "filename", "/etc/opensips/perlfunctions.pl")

onreply_route[1]
{
    ...
    if(t_check_status("183")) {
        perl_exec("sendReplyAs180");
        drop();
    }
}
---

Attached to this mail you can also find a screenshot of an example
call (if call setup on screenshot seems to be strange: that's because
of using uac_auth).

I tested the whole thing with a stupid client behind NAT, without
STUN support. Still working fine!

Have phun,
Thomas Gelf


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

perlfunctions.pl (3K) Download Attachment
siptrace_183_to_180_rewrite.png (16K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Sending 180 Reply for incoming 183 Early media (instead of)

Zizolazizo
print "Hello World\n";

if (Thomas!= Friendly){
print " OpenSIPS Fatal error\n";
}

---------------------------------------
Compiling.................
Error: Config Error... Line 3: you cannot use this statement and change this variable cause Thomas is Very friendly......
System shutdown.....
---------------------------------------------

Thomas Gelf wrote
As expected I had to do some fixes and small changes:

- ReUse option ist required when sharing port 5060 with OpenSIPS
- some oversights ($m / $message, not passing $ip and $port etc)
- CRLF line after header
- strip_body() doesn't work for replies (even if you put it in a
  different route it will not work)

Some more notes:
- removing topmost Via, re-adding the other ones line by line (even
  if there have been multiple Via's on a single line)
- getting ip and port from the next-topmost Via, with respect to
  "rport" and "received" params
- removing all Content-* header lines
- adding Content-Length: 0
- obviously sending no body

You have to use it as follows:

---
loadmodule "perl.so"
modparam("perl", "filename", "/etc/opensips/perlfunctions.pl")

onreply_route[1]
{
    ...
    if(t_check_status("183")) {
        perl_exec("sendReplyAs180");
        drop();
    }
}
---

Attached to this mail you can also find a screenshot of an example
call (if call setup on screenshot seems to be strange: that's because
of using uac_auth).

I tested the whole thing with a stupid client behind NAT, without
STUN support. Still working fine!

Have phun,
Thomas Gelf


 
 
_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Sending 180 Reply for incoming 183 Early media (instead of)

Thomas Gelf
In reply to this post by Thomas Gelf
I had to fix one more little issue, script did not correctly remove all
Content-* lines.

Best regards,
Thomas Gelf


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

perlfunctions.pl (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Sending 180 Reply for incoming 183 Early media (instead of)

Bogdan-Andrei Iancu
Hi Thomas,

maybe you can upload the script with some explanations on the
opensips.org web site - this will help other people to find this info
much faster.

Thanks and regards,
Bogdan

Thomas Gelf wrote:

> I had to fix one more little issue, script did not correctly remove all
> Content-* lines.
>
> Best regards,
> Thomas Gelf
>
>  
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>  


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Sending 180 Reply for incoming 183 Early media (instead of)

Thomas Gelf
Bogdan-Andrei Iancu wrote:
> maybe you can upload the script with some explanations on the
> opensips.org web site - this will help other people to find this info
> much faster.

Done so, please have a quick look on it:

  http://www.opensips.org/index.php?n=Resources.DocsTutorials#toc6

I posted the script as-is, please feel free to replace the harsh header
with whatever appears to be politically correct ;-)

Cheers,
Thomas Gelf


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users