Re: [OpenSIPStack] MWI Notify
Brought to you by:
joegenbaclor
From: Jamieson, W. W <jam...@RL...> - 2009-04-21 16:31:39
|
I have it working somewhat now but I notice on the wire that the content-length is zero. It's supposed to be the size of all the custom headers from what I can tell from the RFC. Is there a standard way of setting this? Also, I'm not getting the notification from ClientSession::OnIncomingSIPMessage when the server sends back it's status 100 "Trying" packet (see capture below). Here's what went on the wire. It shows an Internal Server Error but I'm not sure it is from the content length being zero. In the last version of the MWI service, I wrote my own SIP commands to do this, I found that I had to use Invite to get it to work even though Dialogic Support was telling me that they accept Notify and they reminded me that Invite may go away since it is not the standard. I just assumed that it was because I had written my own SIP commands to do it. I'll keep at this and maybe try it against our Cisco CM to see how it behaves. No. Time Source Destination Protocol Info 488 09:02:49.359600 130.97.35.171 130.97.10.5 SIP Request: NOTIFY sip:3768720@130.97.10.5:5060 Frame 488 (586 bytes on wire, 586 bytes captured) Ethernet II, Src: Dell_4e:64:f8 (00:21:9b:4e:64:f8), Dst: Cisco_f3:26:45 (00:18:ba:f3:26:45) Internet Protocol, Src: 130.97.35.171 (130.97.35.171), Dst: 130.97.10.5 (130.97.10.5) User Datagram Protocol, Src Port: vtsas (5070), Dst Port: sip (5060) Source port: vtsas (5070) Destination port: sip (5060) Length: 552 Checksum: 0xeb12 [correct] Session Initiation Protocol Request-Line: NOTIFY sip:3768720@130.97.10.5:5060 SIP/2.0 Message Header From: <sip:tes...@op...>;tag=5385369e3efe18109d428376cc92421d To: sip:3768720@130.97.10.5:5060 Via: SIP/2.0/UDP 130.97.35.171:5070;iid=417;branch=z9hG4bK5385369e3efe18109d438376cc92421d;uas-addr=130.97.10.5 CSeq: 1 NOTIFY Call-ID: 5385369e-3efe-1810-9603-8376cc92421d Contact: <sip:130.97.35.171:5070> Event: message-summary User-Agent: Sample UA Max-Forwards: 70 Messages-Waiting: yes Message-Account: sip:test_account@localhost Voice-Message: 1/1 Content-Length: 0 No. Time Source Destination Protocol Info 489 09:02:49.374563 130.97.10.5 130.97.35.171 SIP Status: 100 Trying Frame 489 (399 bytes on wire, 399 bytes captured) Ethernet II, Src: Cisco_f3:26:45 (00:18:ba:f3:26:45), Dst: Dell_4e:64:f8 (00:21:9b:4e:64:f8) Internet Protocol, Src: 130.97.10.5 (130.97.10.5), Dst: 130.97.35.171 (130.97.35.171) User Datagram Protocol, Src Port: ibm-pps (1376), Dst Port: vtsas (5070) Source port: ibm-pps (1376) Destination port: vtsas (5070) Length: 365 Checksum: 0x2aa2 [correct] Session Initiation Protocol Status-Line: SIP/2.0 100 Trying Message Header From:<sip:tes...@op...>;tag=5385369e3efe18109d428376cc92421d To:sip:3768720@130.97.10.5:5060 Call-ID:5385369e-3efe-1810-9603-8376cc92421d CSeq:1 NOTIFY Server:PBX-IP Media Gateway/2.1 Via:SIP/2.0/UDP 130.97.35.171:5070;iid=417;branch=z9hG4bK5385369e3efe18109d438376cc92421d;uas-addr=130.97.10.5 Content-Length:0 No. Time Source Destination Protocol Info 490 09:02:49.375037 130.97.10.5 130.97.35.171 SIP Status: 500 Internal Server Error Frame 490 (443 bytes on wire, 443 bytes captured) Ethernet II, Src: Cisco_f3:26:45 (00:18:ba:f3:26:45), Dst: Dell_4e:64:f8 (00:21:9b:4e:64:f8) Internet Protocol, Src: 130.97.10.5 (130.97.10.5), Dst: 130.97.35.171 (130.97.35.171) User Datagram Protocol, Src Port: ibm-pps (1376), Dst Port: vtsas (5070) Source port: ibm-pps (1376) Destination port: vtsas (5070) Length: 409 Checksum: 0x8abc [correct] Session Initiation Protocol Status-Line: SIP/2.0 500 Internal Server Error Message Header From:<sip:tes...@op...>;tag=5385369e3efe18109d428376cc92421d To:sip:3768720@130.97.10.5:5060;tag=27313246313536410067E556 Call-ID:5385369e-3efe-1810-9603-8376cc92421d CSeq:1 NOTIFY Server:PBX-IP Media Gateway/2.1 Via:SIP/2.0/UDP 130.97.35.171:5070;iid=417;branch=z9hG4bK5385369e3efe18109d438376cc92421d;uas-addr=130.97.10.5 Content-Length:0 -----Original Message----- From: Joegen Baclor [mailto:joe...@gm...] Sent: Thursday, April 16, 2009 11:11 PM To: ope...@li... Subject: Re: [OpenSIPStack] MWI Notify Hi Bill, Download the latest OpenSIPStack from CVS. There should now be a sample/client_server_demo directory. It contains the skeleton code for client and server UA. I've used unsolicited MWI notify in the client to better serve your purpose. Here is the snippet from the Main() function. It basically creates two user-agents bound to 5060 and 5070 respectively and let the client (5070) send MWI notify to the server(5060). You can get the response in OnIncomingSIPMessage of the client session. I also pasted the snippet below. Feel free to submit a tutorial based on your experience with this code. HTH, Joegen ----------------------------- void Process::Main() { #if WIN32 SetConsoleCtrlHandler(Win32SignalHandler, TRUE); #endif /// Create the server and and bind it to port 5060 m_UAS = new UA(); m_UAS->GetDefaultProfile().GetTransportProfile().EnableUDP( 0, 5060 ); m_UAS->Initialize(); m_UAS->StartTransportThreads(); m_UAS->m_SM = new SessionManager( *m_UAS ); /// Create the client and bind it to 5070 m_UAC = new UA(); m_UAC->GetDefaultProfile().GetTransportProfile().EnableUDP( 0, 5070 ); m_UAC->Initialize(); m_UAC->StartTransportThreads(); m_UAC->m_SM = new SessionManager( *m_UAC ); OString sesionId = ParserTools::GenGUID(); ClientSession * session = dynamic_cast<ClientSession *>(m_UAC->m_SM->CreateClientSession( m_UAC->GetDefaultProfile(), sesionId )); SIPURI target( "sip:test_account@localhost:5060" ); SIPURI localURI( "sip:tes...@op..." ); Via localVia; m_UAC->ConstructVia( target.GetAddress(), localVia, SIPTransport::UDP ); session->SetTargetURI( target ); session->SetRemoteURI( target ); session->SetLocalURI( localURI ); session->SetLocalVia( localVia ); /// Create a notify and send a test message to the server UA SIPMessage notify; if( session->CreateRequestOutOfDialog( SIPMessage::Method_NOTIFY, notify ) ) { Event event( "message-summary" ); notify.SetEvent( event ); /// Add Event specific headers headers SIPHeader messagesWaiting( "Messages-Waiting", "yes" ); SIPHeader messageAccount( "Message-Account", "sip:test_account@localhost" ); SIPHeader voiceMessage( "Voice-Message", "1/1" ); notify.AddCustomHeader( messagesWaiting ); notify.AddCustomHeader( messageAccount ); notify.AddCustomHeader( voiceMessage ); session->SendRequest( notify ); } Sleep( 5000 ); m_UAC->Terminate(); m_UAS->Terminate(); delete m_UAC; delete m_UAS; } void ClientSession::OnIncomingSIPMessage( SIPMessageArrival & messageEvent ) { SIPMessage message = messageEvent.GetMessage(); if( message.IsResponse() ) { LOG( LogInfo(), "Got SIP Reponse" ); }else { LOG( LogInfo(), "Got SIP Request" ) SIPMessage response; message.CreateResponse( response, SIPMessage::Code200_Ok ); SendRequest( response ); } Destroy(); } -------------------------------------------------- From: "Jamieson, William W" <jam...@RL...> Sent: Friday, April 17, 2009 11:24 AM To: "'Joegen Baclor'" <jb...@so...>; <ope...@li...> Subject: Re: [OpenSIPStack] MWI Notify > That's great! > > Thanks. > > -Bill > > -----Original Message----- > From: Joegen Baclor [mailto:joe...@gm...] > Sent: Thursday, April 16, 2009 6:25 PM > To: ope...@li... > Subject: Re: [OpenSIPStack] MWI Notify > > Hey Jaimieson, > > I'll try to crank up a sample application for MWI as your basis. It > quite > time we put some sample tutorials in opensipstack. Give it several hours. > > Joegen > > -------------------------------------------------- > From: "Jamieson, William W" <jam...@RL...> > Sent: Thursday, April 16, 2009 9:35 PM > To: <ope...@li...> > Subject: [OpenSIPStack] MWI Notify > >> >> I'm really after sending an MWI Notify and I'm using the MWIResource >> and MWIPackage classes. It's an unsolicited Notify so I can't see why >> I need a subscription but that's the way the classes were written, I >> think. >> >> For now, I have given up on the two MWI classes. This is what I have: >> >> Make a SIPMessage called notify which I fill with all the fields I >> see defined in RFC 3842 (MWI) ... (code omitted) >> >> Make a sessionManager >> >> B2BUserAgent ua("MWI"); >> RFC3265ClientManager sessionMgr(ua, "MWI", 1, 1024 * 2); >> >> Make a SIPSession: >> >> RFC3265ClientManager::SubscriptionInfo info("reg", fromURI, >> "application/reginfo+xml"); // stole this so not sure what the args >> are >> OString sessionId = ParserTools::GenGUID(); SIPSession *session = >> sessionMgr.CreateClientSession(info, sessionId); // now I have the >> sessionId for the notify CallId which I add to the notify SIPMessage >> >> Send the request >> >> sessionMgr.SendRequest(invite); >> >> Though it compiles, I know it's not right since I'm not getting >> anything out on the wire. Am I even close? I thought of using this >> instead of the call to SendRequest but it doesn't seem right to call >> an event procedure directly... >> >> sessionMgr.OnUnsolicitedNotification(invite); >> >> It's very frustrating to work with no samples or docs, it's like >> trying to reverse engineer the whole thing. Can someone steer me to >> where I might find these? >> >> billjam >> --------------------------------------------------------------------- >> - >> -------- Stay on top of everything new and different, both inside and >> around Java (TM) technology - register by April 22, and save $200 on >> the JavaOne (SM) conference, June 2-5, 2009, San Francisco. >> 300 plus technical and hands-on sessions. Register today. >> Use priority code J9JMT32. http://p.sf.net/sfu/p >> _______________________________________________ >> opensipstack-devel mailing list >> ope...@li... >> https://lists.sourceforge.net/lists/listinfo/opensipstack-devel > > > >> >> No virus found in this incoming message. >> Checked by AVG - www.avg.com >> Version: 8.0.238 / Virus Database: 270.11.58/2061 - Release Date: >> 04/15/09 19:52:00 >> > > ---------------------------------------------------------------------- > -------- Stay on top of everything new and different, both inside and > around Java > (TM) technology - register by April 22, and save $200 on the JavaOne > (SM) conference, June 2-5, 2009, San Francisco. > 300 plus technical and hands-on sessions. Register today. > Use priority code J9JMT32. http://p.sf.net/sfu/p > _______________________________________________ > opensipstack-devel mailing list > ope...@li... > https://lists.sourceforge.net/lists/listinfo/opensipstack-devel > > ---------------------------------------------------------------------- > -------- Stay on top of everything new and different, both inside and > around Java (TM) technology - register by April 22, and save $200 on > the JavaOne (SM) conference, June 2-5, 2009, San Francisco. > 300 plus technical and hands-on sessions. Register today. > Use priority code J9JMT32. http://p.sf.net/sfu/p > _______________________________________________ > opensipstack-devel mailing list > ope...@li... > https://lists.sourceforge.net/lists/listinfo/opensipstack-devel > > > No virus found in this incoming message. > Checked by AVG - www.avg.com > Version: 8.0.238 / Virus Database: 270.11.59/2063 - Release Date: > 04/16/09 16:38:00 > ------------------------------------------------------------------------------ Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. 300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p _______________________________________________ opensipstack-devel mailing list ope...@li... https://lists.sourceforge.net/lists/listinfo/opensipstack-devel |