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();
}