[OpenSIPS-Users] OpenSIPS as simple SIP proxy
Conor Power
conorjpower at hotmail.com
Wed Jan 13 23:42:58 EST 2021
Thanks Johan.
I generated the residential config and am using that now. It looks as follows:
route{
if (!mf_process_maxfwd_header(10)) {
send_reply(483,"Too Many Hops");
exit;
}
if (has_totag()) {
# handle hop-by-hop ACK (no routing required)
if ( is_method("ACK") && t_check_trans() ) {
t_relay();
exit;
}
# sequential request within a dialog should
# take the path determined by record-routing
if ( !loose_route() ) {
# we do record-routing for all our traffic, so we should not
# receive any sequential requests without Route hdr.
send_reply(404,"Not here");
exit;
}
if (is_method("BYE")) {
# do accounting even if the transaction fails
do_accounting("log","failed");
}
# route it out to whatever destination was set by loose_route()
# in $du (destination URI).
route(relay);
exit;
}
# CANCEL processing
if (is_method("CANCEL")) {
if (t_check_trans())
t_relay();
exit;
}
# absorb retransmissions, but do not create transaction
t_check_trans();
if ( !(is_method("REGISTER") ) ) {
if (is_myself("$fd")) {
} else {
# if caller is not local, then called number must be local
if (!is_myself("$rd")) {
send_reply(403,"Relay Forbidden");
exit;
}
}
}
# preloaded route checking
if (loose_route()) {
xlog("L_ERR",
"Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]");
if (!is_method("ACK"))
send_reply(403,"Preload Route denied");
exit;
}
# record routing
if (!is_method("REGISTER|MESSAGE"))
record_route();
# account only INVITEs
if (is_method("INVITE")) {
do_accounting("log");
}
if (!is_myself("$rd")) {
append_hf("P-hint: outbound\r\n");
route(relay);
}
# requests for my domain
if (is_method("PUBLISH|SUBSCRIBE")) {
send_reply(503, "Service Unavailable");
exit;
}
if (is_method("REGISTER")) {
if ($socket_in(proto) == "tcp")
setflag("TCP_PERSISTENT");
if (!save("location"))
sl_reply_error();
exit;
}
if ($rU==NULL) {
# request with no Username in RURI
send_reply(484,"Address Incomplete");
exit;
}
# do lookup with method filtering
if (!lookup("location","m")) {
t_reply(404, "Not Found");
exit;
}
# when routing via usrloc, log the missed calls also
do_accounting("log","missed");
route(relay);
}
I'm not sure where I should be adding the sethostport in this config.
Any further pointers would be great or to a relevant mail or tutorial.
Conor
________________________________
From: Users <users-bounces at lists.opensips.org> on behalf of Johan De Clercq <Johan at democon.be>
Sent: Wednesday, January 13, 2021 12:27 AM
To: OpenSIPS users mailling list <users at lists.opensips.org>
Subject: Re: [OpenSIPS-Users] OpenSIPS as simple SIP proxy
take the residential config and see where that gets you.
Op wo 13 jan. 2021 om 08:21 schreef Conor Power <conorjpower at hotmail.com<mailto:conorjpower at hotmail.com>>:
Hi,
Apologies for the noob question but I'm hoping someone can point me in the right direction.
I am trying to use OpenSIPS as a simple proxy to proxy all calls to another SIP endpoint and back again to the original client. The only role of the OpenSIPS server is to function as the proxy and it is for all requests.
I have OpenSIPS up and running and can see the requests coming inbound using ngrep but I've had no success proxying the requests.
I added a sethostport() call in the config file but really am not sure where or how it fits in.
If someone might point me to a simple config file that would be used for such a proxy setup, it would be greatly appreciated.
Conor
_______________________________________________
Users mailing list
Users at lists.opensips.org<mailto:Users at 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/20210113/a19fd2c4/attachment-0001.html>
More information about the Users
mailing list