Skip to content

Commit

Permalink
mos score in native script kamailio
Browse files Browse the repository at this point in the history
  • Loading branch information
altanai committed May 13, 2020
1 parent 051e787 commit d482a9d
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 16 deletions.
Binary file added mos_rtpstats_rtpengine/g711a.pcap
Binary file not shown.
Binary file added mos_rtpstats_rtpengine/g711pcma.pcap
Binary file not shown.
32 changes: 17 additions & 15 deletions mos_rtpstats_rtpengine/kamailio.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#!substdef "!MY_SIP_PORT!5060!g"
#!substdef "!MY_SIPS_PORT!5061!g"

#!substdef "!MY_IP4_ADDR!192.168.1.105!g"
#!substdef "!MY_EXTERNAL_IP!192.168.1.105!g"
#!substdef "!MY_IP4_ADDR!172.20.10.8!g"
#!substdef "!MY_EXTERNAL_IP!172.20.10.8!g"

#!ifdef WITH_MYSQL
#!ifndef DBURL
Expand Down Expand Up @@ -100,7 +100,7 @@ loadmodule "xlog.so"
loadmodule "sanity.so"
loadmodule "ctl.so"
loadmodule "cfg_rpc.so"
loadmodule "counters.so"
# loadmodule "counters.so"

loadmodule "dialog.so"
loadmodule "textops.so"
Expand Down Expand Up @@ -175,11 +175,9 @@ modparam("xmlrpc", "url_match", "^/RPC")
#!endif

# ----- rtpengine params -----
modparam("rtpengine", "rtpengine_sock", "udp:13.234.177.239:13816")
modparam("rtpengine", "rtpengine_sock", "udp:3.90.71.92:2222")
modparam("rtpengine", "extra_id_pv", "$avp(extra_id)")

# modparam("rtpengine", "db_url", DBURL)
# modparam("rtpengine", "table_name" , "rtpengine")
modparam("rtpengine", "rtpengine_allow_op", 1)
modparam("rtpengine", "queried_nodes_limit", 4)
modparam("rtpengine", "rtpengine_retr", 2)
Expand Down Expand Up @@ -268,14 +266,16 @@ request_route {

# account only INVITEs
if (is_method("INVITE")) {

xlog("L_INFO"," INVITE processing \n");
if (has_body("application/sdp")) {
sdp_print("1");
xlog("L_INFO"," INVITE has SDP , ask rtpengine to modify it for a new offer \n");
$var($rtp_flag) = "ICE=remove RTP/AVPF full-rtcp-attribute direction=internal replace-origin replace-session-connection label=Aleg_label";
rtpengine_offer( $var(rtp_flag));
# rtpengine_offer();
# rtpengine_manage();
# $var($rtp_flag) = "ICE=remove RTP/AVPF full-rtcp-attribute direction=internal replace-origin replace-session-connection record-call=yes label=Aleg_label PCMA,PCMU";
# rtpengine_offer($var(rtp_flag));
# rtpengine_manage();
# rtpengine_offer( "label=Aleg_label");
rtpengine_offer("replace-origin replace-session-connection ICE=remove label=Aleg_label");
}

}
Expand Down Expand Up @@ -305,6 +305,7 @@ route[RELAY] {
}

if (!t_relay("3.223.129.191","5080")) {
# if (!t_relay("13.234.177.239","5555")) {
xlog("L_ALERT"," Relay failed \n");
sl_reply_error();
}
Expand Down Expand Up @@ -357,8 +358,8 @@ route[WITHINDLG] {

xlog("L_INFO", " BYE processing collect mos score \n");

$avp("mos_A_label")="Aleg_label";
$avp("mos_B_label")="Bleg_label";
$avp("mos_A_label")="Aleg_label";
$avp("mos_B_label")="Bleg_label";

xlog("L_INFO", " rtpstats - $rtpstat\r\n ");
append_hf("X-RTP-Statistics: $rtpstat\r\n");
Expand Down Expand Up @@ -497,10 +498,11 @@ onreply_route[MANAGE_REPLY] {
if (has_body("application/sdp")){
sdp_print("1");
xlog("L_INFO", "Got a succesful reply , ask rtpengine to modify answer SDP \n ");
$var($rtp_flag) = "ICE=remove RTP/AVPF full-rtcp-attribute direction=internal replace-origin replace-session-connection label=Bleg_label";
rtpengine_answer($var($rtp_flag));
# rtpengine_answer();
# $var($rtp_flag) = "ICE=remove RTP/AVPF full-rtcp-attribute direction=internal replace-origin replace-session-connection record-call=yes label=Bleg_label";
# rtpengine_answer($var($rtp_flag));
# rtpengine_manage();
# rtpengine_answer("label=Bleg_label");
rtpengine_answer("replace-origin replace-session-connection ICE=remove label=Bleg_label");
}

# if status is not 1xx or 2xx , do natmanage
Expand Down
Binary file added mos_rtpstats_rtpengine/rtp_example.raw
Binary file not shown.
Loading

0 comments on commit d482a9d

Please sign in to comment.