you can try my MSRP proxy code
[root@proxy-us-west-2-intrado-1 ~]# cat /etc/kamailio/msrp-proxy.cfg
tcp_accept_no_cl=yes
tcp_connection_lifetime=1810
loadmodule "msrp.so"
modparam("htable", "htable", "msrp=>size=16;")
# "msrpcallid" table we use to be pass MSRP session related to call
modparam("htable", "htable", "msrpcallid=>size=16;")
route[MSRP_INJECT_PROXY]
{
if (!sdp_with_media("message")) {
return;
}
$avp(sessid) = $sht(msrpcallid=>$ci::sessid);
if( $avp(sessid) == $null) {
$var(cnt) = $var(cnt) + 1;
pv_printf("$avp(sessid)", "s.$(pp).$(var(cnt)).$(RANDOM)");
$sht(msrpcallid=>$ci::sessid) = $avp(sessid);
}
xlog("L_INFO", "$ci|log|injecting Kamailio in MSRP path with
session_id: $avp(sessid)\n");
search_append_body("a=path:msrps://", $RAi + ":2856/" +
$avp(sessid) +
";tcp msrps://");
search_append_body("a=path:msrp://", $RAi + ":2855/" +
$avp(sessid) +
";tcp msrp://");
if (!isflagset(FLAG_SESSION_PROGRESS)) {
$sht(msrp=>$avp(sessid)::call_id) = $ci;
}
}
event_route[msrp:frame-in] {
msrp_reply_flags("1");
$avp(sessid) = $msrp(sessid);
if (msrp_is_reply()) {
route(UPDATE_MSRP_CONNECTION_DATA);
} else if ($msrp(method)=="SEND" || $msrp(method)=="REPORT") {
if ($msrp(nexthops)>1) {
if ($msrp(method)!="REPORT") {
msrp_reply("200", "OK");
}
msrp_relay();
exit;
}
xlog("L_INFO", "$ci|log|Status of MSRP caller session_id:
$avp(sessid)\n");
if($sht(msrp=>$avp(sessid)::call_id) == $null) {
if ($msrp(method)!="REPORT") {
msrp_reply("481", "Session-does-not-exist");
}
exit;
} else if($msrp(method)!="REPORT") {
msrp_reply("200", "OK");
}
route(UPDATE_MSRP_CONNECTION_DATA);
} else {
msrp_reply("501", "Request-method-not-understood");
}
}
route[UPDATE_MSRP_CONNECTION_DATA] {
# Updating current connection data for responses
$sht(msrp=>$msrp(prevhop)::srcaddr) = $msrp(srcaddr);
$sht(msrp=>$msrp(prevhop)::srcsock) = $msrp(srcsock);
# Try get destination connection data
$avp(srcaddr) = $sht(msrp=>$msrp(nexthop)::srcaddr);
$avp(srcsock) = $sht(msrp=>$msrp(nexthop)::srcsock);
xlog("L_INFO", "$ci|log|destination connection data, srcaddr
$avp(srcaddr), srcsock $avp(srcsock)\n");
if ($avp(srcaddr) == $null || $avp(srcsock) == $null) {
xlog("L_INFO", "$ci|log|no destination msrp connection data, try
relay message for session_id: $avp(sessid)\n");
msrp_relay();
exit;
}
msrp_relay_flags("1");
msrp_set_dst("$avp(srcaddr)", "$avp(srcsock)");
xlog("L_INFO", "$ci|log|relaying msrp message for session_id
'$var(sessid)' via socket $avp(srcsock) to $avp(srcaddr)\n");
msrp_relay();
}
On Tue, Mar 31, 2020 at 4:10 PM Sefa Cebe <sefacebe1(a)gmail.com> wrote:
Of course, I added the following lines to original
kamailio.cfg file. My
aim was to change nexthop or change destination address which comes inside
msrp frame. If I could do this, I can send MSRP messages to wherever I
wanted. However, It doesn't let me to manipulate the variables inside msrp
frame. By doing $msrp(nexthop) = something or using msrp_set_dst function.
#$msrp(nexthop) = ("msrp://192.168.1.100:30000/r02XBu00;tcp");
#xdbg("============ nexthop after modify\n");
#xdbg("============ nexthop: [$msrp(nexthop)]\n");
#msrp_set_dst("msrp://192.168.1.100:30001","tcp:192.168.1.110:64066");
xdbg("============test===========\n");
#$sht(msrp(nexthop))="msrp://192.168.1.100:30001";
$sht(msrp=>$var(sessid)::nexthop) = ("msrp://
192.168.1.100:30000/r02XBu00;tcp");
xdbg("============ nexthop: [$msrp(nexthop)]\n");
xdbg("============checkcontrol\n");
msrp_relay();
msrp_reply("200", "OK");
exit;
Sergey Safarov <s.safarov(a)gmail.com>om>, 31 Mar 2020 Sal, 04:26 tarihinde
şunu yazdı:
Could you share your minimal config and related
logs.
This will be interest for me to look.
On Tue, Mar 31, 2020 at 2:11 PM Sefa Cebe <sefacebe1(a)gmail.com> wrote:
Hello,
I'm using Kamailio MSRP module as a MSRP relay, It works successfully
when I send one-to-one MSRP messages. I am having trouble while sending
msrp messages to multiple receivers. My question is that can I use this
module to forward msrp messages not just one receiver, but multiple
receivers? Can this module be used like MSRP switch?
Thanks in advance.
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users(a)lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users(a)lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users(a)lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users