[OpenSIPS-Users] OCS-Asterisk Gateway tcp-to-udp

Bogdan-Andrei Iancu bogdan at voice-system.ro
Fri Oct 24 14:34:28 CEST 2008


Hi Steffen,

Do you get the CANCEL on your opensips ? if so, do you see the xlog 
messages for the CANCEL?

Also looking at your script, I see a duplicate block - you do the 
routing in the main route and again in route[1] - you should remove the 
route[1] from your script.

Regards,
Bogdan

Steffen Görlach wrote:
>
> Hello to all,
>
> I`m trying to setup opensips as a gateway from Office Communication 
> Server (tcp) to Asterisk (udp). I followed this guide: 
> http://confluence.terena.org:8080/display/IPTelCB/3.2.7.+Tying+MS+OCS+with+Asterisk+through+OpenSER
>
> My Setup is:
>
> Trixbox with 2 IPs:
>
> 192.168.67.4 -> Asterisk (Port 5060)
>
> 192.168.67.5 -> Opensips (Port 5060)
>
> Office Communication Server 2007
>
> 192.168.67.83 -> OCS-Mediation-Server (Port 5060)
>
> This Setup can establish phone calls , but I got problems with the 
> SIP-Status messages. If I call from OCS-Phone to Asterisk Extension 
> and I cancel the Call, the Asterisk Phone don’t get this Cancel-Message.
>
> *How can I route all of the SIP-messages to the Asterisk and the other 
> way?*
>
> * *
>
> My log posts this ERROR (I don`t if this matters for my Problem):
>
> ERROR:core:forward_reply: no 2nd via found in reply
>
> * *
>
> Here is my opensips.cfg:
>
> #
>
> # $Id: opensips.cfg 4423 2008-06-27 10:25:01Z henningw $
>
> #
>
> # OpenSIPS basic configuration script
>
> # by Anca Vamanu <anca at voice-system.ro>
>
> #
>
> # Please refer to the Core CookBook at 
> http://www.opensips.org/dokuwiki/doku.php
>
> # for a explanation of possible statements, functions and parameters.
>
> #
>
> ####### Global Parameters #########
>
> debug=3
>
> log_stderror=no
>
> log_facility=LOG_LOCAL0
>
> fork=yes
>
> children=4
>
> /* uncomment the following lines to enable debugging */
>
> #debug=6
>
> #fork=no
>
> #log_stderror=yes
>
> /* uncomment the next line to disable TCP (default on) */
>
> disable_tcp=no
>
> /* uncomment the next line to enable the auto temporary blacklisting of
>
> not available destinations (default disabled) */
>
> #disable_dns_blacklist=no
>
> /* uncomment the next line to enable IPv6 lookup after IPv4 dns
>
> lookup failures (default disabled) */
>
> #dns_try_ipv6=yes
>
> /* uncomment the next line to disable the auto discovery of local aliases
>
> based on revers DNS on IPs (default on) */
>
> auto_aliases=no
>
> /* uncomment the following lines to enable TLS support (default off) */
>
> #disable_tls = no
>
> #listen = tls:your_IP:5061
>
> #tls_verify_server = 1
>
> #tls_verify_client = 1
>
> #tls_require_client_certificate = 0
>
> #tls_method = TLSv1
>
> #tls_certificate = "//etc/opensips/tls/user/user-cert.pem"
>
> #tls_private_key = "//etc/opensips/tls/user/user-privkey.pem"
>
> #tls_ca_list = "//etc/opensips/tls/user/user-calist.pem"
>
> #port=5061
>
> /* uncomment and configure the following line if you want opensips to
>
> bind on a specific interface/port/proto (default bind on all available) */
>
> listen=udp:192.168.67.5:5060
>
> listen=tcp:192.168.67.5:5060
>
> ####### Modules Section ########
>
> #set module path
>
> mpath="//lib/opensips/modules/"
>
> /* uncomment next line for MySQL DB support */
>
> #loadmodule "db_mysql.so"
>
> loadmodule "sl.so"
>
> loadmodule "tm.so"
>
> loadmodule "rr.so"
>
> loadmodule "maxfwd.so"
>
> loadmodule "usrloc.so"
>
> loadmodule "registrar.so"
>
> loadmodule "textops.so"
>
> loadmodule "mi_fifo.so"
>
> loadmodule "uri_db.so"
>
> loadmodule "uri.so"
>
> loadmodule "xlog.so"
>
> loadmodule "acc.so"
>
> /* uncomment next lines for MySQL based authentication support
>
> NOTE: a DB (like db_mysql) module must be also loaded */
>
> #loadmodule "auth.so"
>
> #loadmodule "auth_db.so"
>
> /* uncomment next line for aliases support
>
> NOTE: a DB (like db_mysql) module must be also loaded */
>
> #loadmodule "alias_db.so"
>
> /* uncomment next line for multi-domain support
>
> NOTE: a DB (like db_mysql) module must be also loaded
>
> NOTE: be sure and enable multi-domain support in all used modules
>
> (see "multi-module params" section ) */
>
> #loadmodule "domain.so"
>
> /* uncomment the next two lines for presence server support
>
> NOTE: a DB (like db_mysql) module must be also loaded */
>
> #loadmodule "presence.so"
>
> #loadmodule "presence_xml.so"
>
> # ----------------- setting module-specific parameters ---------------
>
> # ----- mi_fifo params -----
>
> modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
>
> # ----- rr params -----
>
> # add value to ;lr param to cope with most of the UAs
>
> modparam("rr", "enable_full_lr", 1)
>
> # do not append from tag to the RR (no need for this script)
>
> modparam("rr", "append_fromtag", 0)
>
> # ----- rr params -----
>
> modparam("registrar", "method_filtering", 1)
>
> /* uncomment the next line to disable parallel forking via location */
>
> # modparam("registrar", "append_branches", 0)
>
> /* uncomment the next line not to allow more than 10 contacts per AOR */
>
> #modparam("registrar", "max_contacts", 10)
>
> # ----- uri_db params -----
>
> /* by default we disable the DB support in the module as we do not need it
>
> in this configuration */
>
> modparam("uri_db", "use_uri_table", 0)
>
> modparam("uri_db", "db_url", "")
>
> # ----- acc params -----
>
> /* what sepcial events should be accounted ? */
>
> modparam("acc", "early_media", 1)
>
> modparam("acc", "report_ack", 1)
>
> modparam("acc", "report_cancels", 1)
>
> /* by default ww do not adjust the direct of the sequential requests.
>
> if you enable this parameter, be sure the enable "append_fromtag"
>
> in "rr" module */
>
> modparam("acc", "detect_direction", 0)
>
> /* account triggers (flags) */
>
> modparam("acc", "failed_transaction_flag", 3)
>
> modparam("acc", "log_flag", 1)
>
> modparam("acc", "log_missed_flag", 2)
>
> /* uncomment the following lines to enable DB accounting also */
>
> modparam("acc", "db_flag", 1)
>
> modparam("acc", "db_missed_flag", 2)
>
> ####### Routing Logic ########
>
> # main request routing logic
>
> route{
>
> if (!mf_process_maxfwd_header("10")) {
>
> sl_send_reply("483","Too Many Hops");
>
> exit;
>
> }
>
> if (loose_route()) {
>
> xlog("LOG: loose_route \n");
>
> append_hf("P-hint: rr-enforced\r\n");
>
> route(1);
>
> };
>
> if (!uri==myself)
>
> {
>
> append_hf("P-hint: outbound\r\n");
>
> route(1);
>
> }
>
> if (src_ip == 192.168.67.83) {
>
> #remove misleading CONTACT header line
>
> remove_hf("Contact");
>
> #remove UTF-8 information, as * is not able to process it properly
>
> subst("/^(CONTENT-TYPE:.*);[ ]*charset=utf-8(.*)/\1\2/");
>
> #relay request to *
>
> if (!t_relay("udp:192.168.67.4:5060")) {
>
> xlog("LOG:Goto asterisk \n");
>
> sl_reply_error();
>
> }
>
> }
>
> else {
>
> #relay request to OCS
>
> if (!t_relay("tcp:192.168.67.83:5060") ) {
>
> xlog("LOG:Return to OCS \n");
>
> sl_reply_error();
>
> }
>
> }
>
> route(1);
>
> }
>
> route[1] {
>
> xlog("LOG: Route 1 $src_ip \n");
>
> # If coming from OCS
>
> if (src_ip== 192.168.67.83)
>
> {
>
> if (method=="INVITE|BYE") {
>
> xlog("L_INFO", "*** invite from OCS M=$rm RURI=$ru F=$fu T=$tu IP=$si 
> ID=$ci\n");
>
> }
>
> xlog("LOG: t_relay Asterisk \n $src_ip \n");
>
> t_relay("udp:192.168.67.4:5060");
>
> }
>
> # else coming from Asterisk
>
> else {
>
> xlog("LOG: t_relay OCS \n $src_ip \n");
>
> t_relay("tcp:192.168.67.83:5060");
>
> };
>
> exit;
>
> }
>
> onreply_route {
>
> xlog("LOG: incoming reply \n $src_ip \n $tu \n");
>
> if (src_ip == 192.168.67.83) {
>
> #remove misleading CONTACT header line
>
> remove_hf("Contact");
>
> #remove UTF-8 information, as * is not able to process it properly
>
> subst("/^(CONTENT-TYPE:.*);[ ]*charset=utf-8(.*)/\1\2/");
>
> }
>
> exit;
>
> }
>
> branch_route[1] {
>
> xlog("LOG:new branch at $ru\n");
>
> }
>
> failure_route[1] {
>
> if (t_was_cancelled()) {
>
> exit;
>
> }
>
> }
>




More information about the Users mailing list