Hi All,

I need some help regarding SIP SUBSCRIBE message received on FreeSwitch Server.

Following is the Message Sequence event observed:
REGISTER ........................................(Received by FS)
401 Unauthorized ….. (Sent by FS)
REGISTER ........................................(Received by FS)
200 OK .......................(Sent by FS)
SUBSCRIBE ......................................(Received by FS)
489 Bad Event ............(Sent by FS)
PUBLISH ..........................................(Received by FS)
489 Bad Event ............(Sent by FS)
SUBSCRIBE ......................................(Received by FS)
200 OK ........................(Sent by FS)

In above sequence please note that message no. 5 – SIP SUBSCRIBE – and message no. 7 – SIP PUBLISH – have Content-Type as multipart/mixed.

For my application purpose, I need to use the info received in these messages and should respond back to client accordingly.

Can someone help me to point out exact places where these messages are being processed? 

Following is the SIP Trace of transaction:

freeswitch@shantala-Lenovo-G50-80> recv 883 bytes from udp/[10.196.23.129]:41196 at 14:42:12.589859:
   ------------------------------------------------------------------------
   REGISTER sip:10.198.17.13 SIP/2.0
   Via: SIP/2.0/UDP 10.196.23.129:41196;branch=z9hG4bK-479585552;rport
   From: <sip:mcx.iitb-333.iitb@10.198.17.13>;tag=461418457
   To: <sip:mcx.iitb-333.iitb@10.198.17.13>
   Contact: <sip:mcx.iitb-333.iitb@10.196.23.129:41196;transport=udp>;expires=1700;audio;+g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-service.ims.icsi.mcptt";+g.3gpp.cs-voice;+g.3gpp.mcptt
   Call-ID: 9b288895-6627-9abe-9d0e-cd99fdf87543
   CSeq: 160641516 REGISTER
   Content-Length: 0
   Max-Forwards: 70
   Authorization: Digest username="mcx.iitb-333.iitb",realm="10.198.17.13",nonce="",uri="sip:10.198.17.13",response=""
   Allow: INVITE, ACK, CANCEL, BYE, MESSAGE, OPTIONS, NOTIFY, PRACK, UPDATE, REFER
   Privacy: none
   P-Access-Network-Info: ADSL;utran-cell-id-3gpp=00000000
   User-Agent: MCOP CLIENT MCPTT1.0 /v 0.1
   P-Preferred-Identity: <sip:mcx.iitb-333.iitb@10.198.17.13>
   Supported: path
   
   ------------------------------------------------------------------------
send 668 bytes to udp/[10.196.23.129]:41196 at 14:42:12.590640:
   ------------------------------------------------------------------------
   SIP/2.0 401 Unauthorized
   Via: SIP/2.0/UDP 10.196.23.129:41196;branch=z9hG4bK-479585552;rport=41196
   From: <sip:mcx.iitb-333.iitb@10.198.17.13>;tag=461418457
   To: <sip:mcx.iitb-333.iitb@10.198.17.13>;tag=KFNj23y3mNSmF
   Call-ID: 9b288895-6627-9abe-9d0e-cd99fdf87543
   CSeq: 160641516 REGISTER
   User-Agent: FreeSWITCH-mod_sofia/1.6.20+git~20190620T062758Z~11af54ff65~64bit
   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
   Supported: timer, path, replaces
   WWW-Authenticate: Digest realm="10.198.17.13", nonce="76ac9099-06ef-49be-b966-9c21325cf798", stale=true, algorithm=MD5, qop="auth"
   Content-Length: 0
   
   ------------------------------------------------------------------------
recv 1029 bytes from udp/[10.196.23.129]:41196 at 14:42:12.598409:
   ------------------------------------------------------------------------
   REGISTER sip:10.198.17.13 SIP/2.0
   Via: SIP/2.0/UDP 10.196.23.129:41196;branch=z9hG4bK-1467903459;rport
   From: <sip:mcx.iitb-333.iitb@10.198.17.13>;tag=461418457
   To: <sip:mcx.iitb-333.iitb@10.198.17.13>
   Contact: <sip:mcx.iitb-333.iitb@10.196.23.129:41196;transport=udp>;expires=1700;audio;+g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-service.ims.icsi.mcptt";+g.3gpp.cs-voice;+g.3gpp.mcptt
   Call-ID: 9b288895-6627-9abe-9d0e-cd99fdf87543
   CSeq: 160641517 REGISTER
   Content-Length: 0
   Max-Forwards: 70
   Authorization: Digest username="mcx.iitb-333.iitb",realm="10.198.17.13",nonce="76ac9099-06ef-49be-b966-9c21325cf798",uri="sip:10.198.17.13",response="51acffef02d3a6b73c78aec6b26dcec2",algorithm=MD5,cnonce="8e1cf72f4cd5fd37a6ccbb1b821eeb94",qop=auth,nc=00000001
   Allow: INVITE, ACK, CANCEL, BYE, MESSAGE, OPTIONS, NOTIFY, PRACK, UPDATE, REFER
   Privacy: none
   P-Access-Network-Info: ADSL;utran-cell-id-3gpp=00000000
   User-Agent: MCOP CLIENT MCPTT1.0 /v 0.1
   P-Preferred-Identity: <sip:mcx.iitb-333.iitb@10.198.17.13>
   Supported: path
   
   ------------------------------------------------------------------------
send 645 bytes to udp/[10.196.23.129]:41196 at 14:42:12.600354:
   ------------------------------------------------------------------------
   SIP/2.0 200 OK
   Via: SIP/2.0/UDP 10.196.23.129:41196;branch=z9hG4bK-1467903459;rport=41196
   From: <sip:mcx.iitb-333.iitb@10.198.17.13>;tag=461418457
   To: <sip:mcx.iitb-333.iitb@10.198.17.13>;tag=mreB4yF7HyF7a
   Call-ID: 9b288895-6627-9abe-9d0e-cd99fdf87543
   CSeq: 160641517 REGISTER
   Contact: <sip:mcx.iitb-333.iitb@10.196.23.129:41196;transport=udp>;expires=1700
   Date: Mon, 01 Jul 2019 09:12:12 GMT
   User-Agent: FreeSWITCH-mod_sofia/1.6.20+git~20190620T062758Z~11af54ff65~64bit
   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
   Supported: timer, path, replaces
   Content-Length: 0
   
   ------------------------------------------------------------------------
recv 1767 bytes from udp/[10.196.23.129]:41196 at 14:42:12.682238:
   ------------------------------------------------------------------------
   SUBSCRIBE sip:mcptt-server-orig-part.organization.org SIP/2.0
   Via: SIP/2.0/UDP 10.196.23.129:41196;branch=z9hG4bK-1600282236;rport
   From: <sip:mcx.iitb-333.iitb@10.198.17.13>;tag=695831546
   To: <sip:mcptt-server-orig-part.organization.org>
   Contact: <sip:mcx.iitb-333.iitb@10.196.23.129:41196;transport=udp>;+g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-service.ims.icsi.mcptt";+g.3gpp.mcptt
   Call-ID: 22b6445e-982e-3034-6046-93ac75341206
   CSeq: 401808965 SUBSCRIBE
   Expires: 3600
   Content-Type: multipart/mixed;boundary=66f2554f-ba0c-fcf8-f9df-6c5375345642
   Content-Length: 808
   Max-Forwards: 70
   Allow: INVITE, ACK, CANCEL, BYE, MESSAGE, OPTIONS, NOTIFY, PRACK, UPDATE, REFER
   Privacy: none
   P-Access-Network-Info: ADSL;utran-cell-id-3gpp=00000000
   User-Agent: MCOP CLIENT MCPTT1.0 /v 0.1
   P-Preferred-Identity: <sip:mcx.iitb-333.iitb@10.198.17.13>
   P-Preferred-Service: urn:urn-7:3gpp-service.ims.icsi.mcptt
   Accept: application/xcap-diff+xml
   Event: xcap-diff
   
   --66f2554f-ba0c-fcf8-f9df-6c5375345642
   Content-Type: application/vnd.3gpp.mcptt-info+xml
   
   <mcpttinfo xmlns="urn:3gpp:ns:mcpttInfo:1.0">
      <mcptt-Params>
         <mcptt-client-id type="Normal">
            <mcpttString>sip:mcx.iitb-333.iitb@10.198.17.13</mcpttString>
         </mcptt-client-id>
         <mcptt-request-uri type="Normal">
            <mcpttURI>sip:mcx.iitb-333.iitb@10.198.17.13</mcpttURI>
         </mcptt-request-uri>
      </mcptt-Params>
   </mcpttinfo>
   --66f2554f-ba0c-fcf8-f9df-6c5375345642
   Content-Type: application/resource-lists+xml
   
   <resource-lists xmlns="urn:ietf:params:xml:ns:resource-lists" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <list>
         <entry uri="org.3gpp.mcptt.ue-config/users/mcptt_UE_id/"/>
      </list>
   </resource-lists>
   --66f2554f-ba0c-fcf8-f9df-6c5375345642--
   ------------------------------------------------------------------------
send 715 bytes to udp/[10.196.23.129]:41196 at 14:42:12.682421:
   ------------------------------------------------------------------------
   SIP/2.0 489 Bad Event
   Via: SIP/2.0/UDP 10.196.23.129:41196;branch=z9hG4bK-1600282236;rport=41196
   From: <sip:mcx.iitb-333.iitb@10.198.17.13>;tag=695831546
   To: <sip:mcptt-server-orig-part.organization.org>;tag=N1735S0aF75Sp
   Call-ID: 22b6445e-982e-3034-6046-93ac75341206
   CSeq: 401808965 SUBSCRIBE
   User-Agent: FreeSWITCH-mod_sofia/1.6.20+git~20190620T062758Z~11af54ff65~64bit
   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
   Supported: timer, path, replaces
   Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
   Content-Length: 0
   
   ------------------------------------------------------------------------
recv 1746 bytes from udp/[10.196.23.129]:41196 at 14:42:12.724245:
   ------------------------------------------------------------------------
   PUBLISH sip:mcptt-server-orig-part.organization.org SIP/2.0
   Via: SIP/2.0/UDP 10.196.23.129:41196;branch=z9hG4bK-1262365214;rport
   From: <sip:mcx.iitb-333.iitb@10.198.17.13>;tag=572479811
   To: <sip:mcptt-server-orig-part.organization.org>
   Contact: <sip:mcx.iitb-333.iitb@10.196.23.129:41196;transport=udp>;+g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-service.ims.icsi.mcptt";+g.3gpp.mcptt
   Call-ID: 44efbb6c-0cb8-bcb9-eda8-34e6fe929c0c
   CSeq: 460922957 PUBLISH
   Expires: 4294967295
   Content-Type: multipart/mixed;boundary=ee899bdf-2023-5552-60d6-aa7ed89cc134
   Content-Length: 817
   Max-Forwards: 70
   Allow: INVITE, ACK, CANCEL, BYE, MESSAGE, OPTIONS, NOTIFY, PRACK, UPDATE, REFER
   Privacy: none
   P-Access-Network-Info: ADSL;utran-cell-id-3gpp=00000000
   User-Agent: MCOP CLIENT MCPTT1.0 /v 0.1
   P-Preferred-Identity: <sip:mcx.iitb-333.iitb@10.198.17.13>
   P-Preferred-Service: urn:urn-7:3gpp-service.ims.icsi.mcptt
   Event: poc-settings
   
   --ee899bdf-2023-5552-60d6-aa7ed89cc134
   Content-Type: application/vnd.3gpp.mcptt-info+xml
   
   <mcpttinfo xmlns="urn:3gpp:ns:mcpttInfo:1.0">
      <mcptt-Params>
         <mcptt-client-id type="Normal">
            <mcpttString>sip:mcx.iitb-333.iitb@10.198.17.13</mcpttString>
         </mcptt-client-id>
         <mcptt-request-uri type="Normal">
            <mcpttURI>sip:mcx.iitb-333.iitb@10.198.17.13</mcpttURI>
         </mcptt-request-uri>
      </mcptt-Params>
   </mcpttinfo>
   --ee899bdf-2023-5552-60d6-aa7ed89cc134
   Content-Type: application/poc-settings+xml
   
   <poc-settings xmlns="urn:oma:params:xml:ns:poc:poc-settings">
      <entity id="564ccb95-66a2-4443-bc80-cfc59e28d2bc">
         <am-settings>
            <answer-mode>automatic</answer-mode>
         </am-settings>
      </entity>
   </poc-settings>
   --ee899bdf-2023-5552-60d6-aa7ed89cc134--
   ------------------------------------------------------------------------
send 713 bytes to udp/[10.196.23.129]:41196 at 14:42:12.724421:
   ------------------------------------------------------------------------
   SIP/2.0 489 Bad Event
   Via: SIP/2.0/UDP 10.196.23.129:41196;branch=z9hG4bK-1262365214;rport=41196
   From: <sip:mcx.iitb-333.iitb@10.198.17.13>;tag=572479811
   To: <sip:mcptt-server-orig-part.organization.org>;tag=pa1v7mHecgvcj
   Call-ID: 44efbb6c-0cb8-bcb9-eda8-34e6fe929c0c
   CSeq: 460922957 PUBLISH
   User-Agent: FreeSWITCH-mod_sofia/1.6.20+git~20190620T062758Z~11af54ff65~64bit
   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
   Supported: timer, path, replaces
   Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
   Content-Length: 0
   
   ------------------------------------------------------------------------
recv 1232 bytes from udp/[10.196.23.129]:41196 at 14:42:17.731697:
   ------------------------------------------------------------------------
   SUBSCRIBE sip:mcptt-server-orig-part.organization.org SIP/2.0
   Via: SIP/2.0/UDP 10.196.23.129:41196;branch=z9hG4bK-1771073717;rport
   From: <sip:mcx.iitb-333.iitb@10.198.17.13>;tag=923465290
   To: <sip:mcptt-server-orig-part.organization.org>
   Contact: <sip:mcx.iitb-333.iitb@10.196.23.129:41196;transport=udp>;+g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-service.ims.icsi.mcptt";+g.3gpp.mcptt
   Call-ID: b9de154c-daaa-800c-a993-ee1ec11dcbbe
   CSeq: 2013176009 SUBSCRIBE
   Expires: 4294967295
   Content-Type: application/vnd.3gpp.mcptt-info+xml
   Content-Length: 298
   Max-Forwards: 70
   Allow: INVITE, ACK, CANCEL, BYE, MESSAGE, OPTIONS, NOTIFY, PRACK, UPDATE, REFER
   Privacy: none
   P-Access-Network-Info: ADSL;utran-cell-id-3gpp=00000000
   User-Agent: MCOP CLIENT MCPTT1.0 /v 0.1
   P-Preferred-Identity: <sip:mcx.iitb-333.iitb@10.198.17.13>
   P-Preferred-Service: urn:urn-7:3gpp-service.ims.icsi.mcptt
   Accept: application/pidf+xml
   Event: presence
   
   <?xml version="1.0" encoding="UTF-8"?>
   <mcpttinfo xmlns="urn:3gpp:ns:mcpttInfo:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <mcptt-Params>
   <mcptt-request-uri type="Normal"><mcpttURI>sip:mcx.iitb-333.iitb@10.198.17.13</mcpttURI></mcptt-request-uri>
   </mcptt-Params>
   </mcpttinfo>
   ------------------------------------------------------------------------
send 811 bytes to udp/[10.196.23.129]:41196 at 14:42:17.744414:
   ------------------------------------------------------------------------
   SIP/2.0 200 OK
   Via: SIP/2.0/UDP 10.196.23.129:41196;branch=z9hG4bK-1771073717;rport=41196
   From: <sip:mcx.iitb-333.iitb@10.198.17.13>;tag=923465290
   To: <sip:mcptt-server-orig-part.organization.org>;tag=my0OZqHdfUzH
   Call-ID: b9de154c-daaa-800c-a993-ee1ec11dcbbe
   CSeq: 2013176009 SUBSCRIBE
   Contact: <sip:@10.198.17.13:5060>
   Expires: 4294967295
   User-Agent: FreeSWITCH-mod_sofia/1.6.20+git~20190620T062758Z~11af54ff65~64bit
   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
   Supported: timer, path, replaces
   Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
   Subscription-State: active;expires=4294967295
   Content-Length: 0
  
   

P.S.: interestingly enough, last SIP SUBSCRIBE message – message #9 – is being processed by sofia_process_dispatch_event(). The previous messages are not.

Thanks
Akshay Patil

--
Akshay Patil
e-mail : ahvpatil@gmail.com
Mob. No. : +91-9930166672