Re: [OpenSIPStack] MWI Notify
Brought to you by:
joegenbaclor
From: Jamieson, W. W <jam...@RL...> - 2009-04-17 13:43:15
|
Delegating the tutorial to me, eh? That's fine, I don't mind paying back a little something for this great piece of work. From what I can tell from the revision history in the files, you pretty much wrote the whole thing your self. Kudos. -Bill -----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 |