Hello Experts, 

I need your advice on the following issue if you can kindly help. 

I am working on a hold call flow:

UA - > Kamailio (RTP Engine) - > FS

initial call establishes fine, RTP engine is invoked and SDP media IP is modified correctly. Then

  1. I am receiving a hold re-invite with a send-only
  2. I see Kamailio is changing the media IP in the SDP (with my RTP engine IP) when it sends the Invite to my core FS server.
  3. FS sends 200 OK with a=recvonly
  4. Kamailio relays the message as it is to the other leg. 


can someone advise me, on how can I invoke rtpengine at step 4, so the SDP is sent with my media server IP in the 200 OK? 

--- 200 OK from FS ----

SIP/2.0 200 OK
Via: SIP/2.0/UDP 13.54.01.02:5060;branch=z9hG4bKd2e8.8a573af8d927f67c1db4550676f8be88.0;i=1
Via: SIP/2.0/TCP 192.168.10.117:51280;received=218.33.01.02;rport=51280;branch=z9hG4bKPj7d1d8968830d4ed3922eec7da7cdc17c;alias
Record-Route: <sip:13.54.01.02:5060;r2=on;lr=on>
Record-Route: <sip:13.54.01.02;transport=tcp;r2=on;lr=on>
From: <sip:0403225908@trunk.xyz.corp>;tag=6a180ffa7f824972a2c59ba47f293acb
To: <sip:+61285038000@trunk.xyz.corp>;tag=DZrpcpgS1BDKF
Call-ID: 4154062196634c34a2dbcb6b612bf44c
CSeq: 12263 INVITE
Contact: <sip:+61285038000@54.88.54.88:5060;transport=udp>
User-Agent: UserAgentX/v1.0
Accept: application/sdp
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY
Require: timer
Supported: timer, path, replaces
Session-Expires: 1800;refresher=uac
Content-Type: application/sdp
Content-Disposition: session
Content-Length: 266

v=0
o=FreeSWITCH 1724635755 1724635757 IN IP4 54.88.54.88
s=FreeSWITCH
c=IN IP4 54.88.54.88
t=0 0
m=audio 21202 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=recvonly
a=ptime:20
a=rtcp:21203 IN IP4 54.88.54.88



--- 200 OK relayed towards the UA ----

2024/08/26 17:22:39.923639 172.16.8.126:5060 -> 218.33.78.33:51280
SIP/2.0 200 OK
Via: SIP/2.0/TCP 192.168.10.117:51280;received=218.33.01.02;rport=51280;branch=z9hG4bKPj7d1d8968830d4ed3922eec7da7cdc17c;alias
Record-Route: <sip:13.54.01.02:5060;r2=on;lr=on>
Record-Route: <sip:13.54.01.02;transport=tcp;r2=on;lr=on>
From: <sip:0403225908@trunk.xyz.corp>;tag=6a180ffa7f824972a2c59ba47f293acb
To: <sip:+61285038000@trunk.xyz.corp>;tag=DZrpcpgS1BDKF
Call-ID: 4154062196634c34a2dbcb6b612bf44c
CSeq: 12263 INVITE
Contact: <sip:+61285038000@54.88.54.88:5060;transport=udp>
User-Agent: UserAgentX/v1.0
Accept: application/sdp
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY
Require: timer
Supported: timer, path, replaces
Session-Expires: 1800;refresher=uac
Content-Type: application/sdp
Content-Disposition: session
Content-Length: 266

v=0
o=FreeSWITCH 1724635755 1724635757 IN IP4 54.88.54.88
s=FreeSWITCH
c=IN IP4 54.88.54.88
t=0 0
m=audio 21202 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=recvonly
a=ptime:20
a=rtcp:21203 IN IP4 54.88.54.88


my configs for within dialog route:

##### 

route[WITHINDLG] {


   append_hf("X-Test-Header: route_WITHINDLG\r\n");


   if (has_totag()) {
      
        if (loose_route()) {

            if (is_method("BYE")) {
                setflag(FLT_ACC); # do accounting ...
                setflag(FLT_ACCFAILED); # ... even if the transaction fails
            }

            if (is_method("ACK")) {
                xlog("L_INFO", "Relaying ACK\n");
            }


        if (is_method("INVITE|UPDATE")) {
            if (has_body("application/sdp") && search_body("m=image") && search_body("T38")) {
               xlog("L_INFO", "T.38 re-INVITE detected, skipping rtpengine invocation\n");
            } else {
               xlog("L_INFO", "Non-T.38 INVITE detected, invoking rtpengine\n");

               rtpengine_manage("replace-origin replace-session-connection");
            }
          }


          route(RELAY);

        } else {
            if (is_method("SUBSCRIBE") && uri == myself) {
                route(PRESENCE);
                exit;
            }
            if (is_method("ACK")) {
                if (t_check_trans()) {
                    t_relay();
                    exit;
                } else {
                    exit;
                }
            }
            sl_send_reply("404","Not here");
        }
        exit;
    }

}

##### 


looking forward to your usual guidance. 

Thank you! 

Regards,
Shah