r3336 - in trunk/libminisip/source: subsystem_media/msrp subsystem_signaling/sdp subsystem_signaling/sip
mafe at minisip.org
mafe at minisip.org
Wed Jun 27 11:36:21 CEST 2007
Author: mafe
Date: 2007-06-27 11:36:20 +0200 (Wed, 27 Jun 2007)
New Revision: 3336
Added:
trunk/libminisip/source/subsystem_signaling/sdp/SdpHeaderI.cxx
trunk/libminisip/source/subsystem_signaling/sip/SipDialogFileTransferClient.cxx
trunk/libminisip/source/subsystem_signaling/sip/SipDialogFileTransferClient.h
trunk/libminisip/source/subsystem_signaling/sip/SipDialogFileTransferServer.cxx
trunk/libminisip/source/subsystem_signaling/sip/SipDialogFileTransferServer.h
Removed:
trunk/libminisip/source/subsystem_media/msrp/MSRPSender.cxx
Modified:
trunk/libminisip/source/subsystem_media/msrp/MSRPMessage.cxx
Log:
Added missing files (state machines for signaling and I header source).
Removed cerr debug output from MSRP
Modified: trunk/libminisip/source/subsystem_media/msrp/MSRPMessage.cxx
===================================================================
--- trunk/libminisip/source/subsystem_media/msrp/MSRPMessage.cxx 2007-06-27 08:50:22 UTC (rev 3335)
+++ trunk/libminisip/source/subsystem_media/msrp/MSRPMessage.cxx 2007-06-27 09:36:20 UTC (rev 3336)
@@ -169,26 +169,21 @@
num_chunks--;
setchunk();
- cerr<<"number of chunks "<<num_chunks<<endl;
+ //cerr<<"number of chunks "<<num_chunks<<endl;
MSRPMessageSend new_msg(chunk, chunkSize);
//cerr<<"MAFE: created new object... "<<endl;
msg = new_msg.CreateMSRPSend(pktLen);
- cerr<<"MAFE: MSRPMessage created! "<<endl;
//int aux = htonl(chunkSize);
if (sock==NULL)
cerr<<"MAFE: socket is NULL"<<endl;
//int sendtam=sock->write((char*)&aux,sizeof(chunkSize));
- cerr <<"will send " << pktLen<< " bytes"<<endl;
assert(sock);
int nsent=sock->write(msg, pktLen);
- //cerr<<msg<<endl;
- cerr <<"EEEEEEEEEEEEE: sent "<< nsent<<" bytes"<<endl;
-
//int reprec = sock->read(report_rec, 1024);
//report_rec[reprec]=0;
@@ -200,16 +195,9 @@
//string byterange = new_msg.UpdateByteRange();
}
- //int aux = htonl(0);
- //int lastsent=sock->write((char*)&aux, sizeof(int));
-
- //finalstring = sock->write("server quit", 12);
- //cerr<<"final de fichero"<<finalstring<<endl;
}
CommandString cmd(callid, "MSRP_DONE");
sipstack->handleCommand(cmd);
-
- //cerr <<"MAFE: server shutting down..."<<endl;
}
void MSRPSender::setchunk(){
@@ -268,22 +256,13 @@
chunkRcv=chunkRcv+1;
do{
- cerr <<"chunks "<<chunkRcv<<endl;
- //cerr<<"sizeblock"<<lng<<endl;
//if(chunkRcv>0){
int nrecv = client_sock->read(receive_buf,10000);
- cerr <<"EEEEEEEEEEEEEEEE: read "<< nrecv <<" bytes."<<endl;
- //cerr<<"buffer recibido "<<receive_buf<<endl;
-
- //receive_buf[nrecv]=0; //it makes sure that this is a null-terminated string
- //from_client=trim(string(receive_buf)); //trim away any leading or trailing whitespace
-
loc = strstr(receive_buf,"Content-Type: ");
- //loc2 = strstr(receive_buf, "-------");
- cerr<<"localizador del content type: "<<loc<<endl;
+ //cerr<<"localizador del content type: "<<loc<<endl;
while(*loc != '\n'){
loc++;
@@ -293,7 +272,7 @@
chunk_buffer_prov[j]=*loc;
loc++;
}
- cerr<<"buffer provisional "<<chunk_buffer_prov<<endl;
+ //cerr<<"buffer provisional "<<chunk_buffer_prov<<endl;
SaveFile.write(chunk_buffer_prov,1024);
}
else{
@@ -301,17 +280,11 @@
chunk_buffer_prov[j]=*loc;
loc++;
}
- cerr<<"buffer provisional "<<chunk_buffer_prov<<endl;
+ //cerr<<"buffer provisional "<<chunk_buffer_prov<<endl;
SaveFile.write(chunk_buffer_prov,aux);
}
-
- //MSRPMessageReport new_rep(chunk_buffer_prov,lng);
- //string_rep = new_rep.CreateMSRPReport();
- //cerr<<"MAFE: Report created: "<<string_rep<<endl;
chunkRcv--;
- //client_sock->write(string_rep.c_str(), string_rep.length());
- //cerr<<"after write report"<<endl;
//}else;
}while(chunkRcv>0);
}
Deleted: trunk/libminisip/source/subsystem_media/msrp/MSRPSender.cxx
===================================================================
--- trunk/libminisip/source/subsystem_media/msrp/MSRPSender.cxx 2007-06-27 08:50:22 UTC (rev 3335)
+++ trunk/libminisip/source/subsystem_media/msrp/MSRPSender.cxx 2007-06-27 09:36:20 UTC (rev 3336)
@@ -1,68 +0,0 @@
-MSRPSender.cxx */
-#include<libmnetutil/TCPSocket.h>
-
-#include<libmnetutil/NetworkException.h> //ConnectFailed && HostNotFound
-#include<libmutil/trim.h> //removes whitespace from start and end of strings
-
-#include <iostream>
-#include <fstream>
-
-#include"../../subsystem_media/msrp/MSRPSender.h"
-#include"../../subsystem_media/msrp/MSRPMessage.h"
-
-using namespace std;
-
-void MSRPSender::run(){
- cerr <<"MAFE: MSRPSender::run() started"<<endl;
-
- MRef<MSRPSender*> msrpSender;
- //= new MSRPSender*(const string serverAdd, int32_t serverPort, const string filename);
- //char new_chunk[] = "";
- //ifstream myfile;
- MRef<MSRPMessageSend*> M_Send;
-
- /*if (argc!=4){
- return 1;
- }
- else{*/
-
-//-------if (no TCPSocket open between offerer and answerer) { --> verify with the URI received by SIP messages.
-
- TCPSocket *sock;
- try{
- //Create a TCP connection to the server (address and port given
- //as arguments to the application).
- sock = new TCPSocket(msrpSender->serverAdd, msrpSender->serverPort);
- }catch(ConnectFailed &){
- cerr << "Sorry, I could not connect to port "<< msrpSender.serverPort << " on the server." << endl;
- return -3;
-
- }catch(HostNotFound &){
- cerr << "Sorry, the server <"<< msrpSender.serverAdd<<"> could not be found"<< endl;
- return -3;
- }
-//----- } else;
-
- myfile.open(filetosend,ios::in|ios::binary|ios::ate);
- if (myfile.is_open())
- {
- while( !myfile.eof() )
- {
- while(M_Send.BytesLeft != 0)
- {
- M_Send.CreateMSRPSend(setchunk.set_chunk, sizeof(setchunk.set_chunk));
-
- // ToDo Receive_Report;
- }
- else;
-
- // error detect. with Report -->cerr << "Sorry, chunk not received correctly, trying again" << endl;
-
- }
- }
- }
- else
- cerr << "Unable to open file" << endl;
-
- sock->close();
-}
Added: trunk/libminisip/source/subsystem_signaling/sdp/SdpHeaderI.cxx
===================================================================
--- trunk/libminisip/source/subsystem_signaling/sdp/SdpHeaderI.cxx (rev 0)
+++ trunk/libminisip/source/subsystem_signaling/sdp/SdpHeaderI.cxx 2007-06-27 09:36:20 UTC (rev 3336)
@@ -0,0 +1,60 @@
+/*
+ Copyright (C) 2004-2006 the Minisip Team
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* Copyright (C) 2004
+ *
+ * Authors: Erik Eliasson <eliasson at it.kth.se>
+ * Johan Bilien <jobi at via.ecp.fr>
+*/
+
+/* Name
+ * SdpHeaderI.cxx
+ * Author
+ * Erik Eliasson, eliasson at it.kth.se
+ * Purpose
+ *
+*/
+
+#include<config.h>
+
+
+#include<libminisip/signaling/sdp/SdpHeaderI.h>
+#include<libmutil/stringutils.h>
+#include<libmutil/massert.h>
+
+using namespace std;
+
+SdpHeaderI::SdpHeaderI(string buildFrom):SdpHeader(SDP_HEADER_TYPE_I, 9){
+ massert(buildFrom.substr(0,2)=="i=");
+ session_information = trim(buildFrom.substr(2, buildFrom.length()-2));
+}
+
+SdpHeaderI::~SdpHeaderI(){
+
+}
+
+string SdpHeaderI::getSessionInformation(){
+ return session_information;
+}
+void SdpHeaderI::setSessionInformation(string s){
+ this->session_information = s;
+}
+
+string SdpHeaderI::getString(){
+ return "i="+session_information;
+}
Added: trunk/libminisip/source/subsystem_signaling/sip/SipDialogFileTransferClient.cxx
===================================================================
--- trunk/libminisip/source/subsystem_signaling/sip/SipDialogFileTransferClient.cxx (rev 0)
+++ trunk/libminisip/source/subsystem_signaling/sip/SipDialogFileTransferClient.cxx 2007-06-27 09:36:20 UTC (rev 3336)
@@ -0,0 +1,444 @@
+/*
+ Copyright (C) 2004-2006 the Minisip Team
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* Copyright (C) 2004-2006
+ *
+ * Authors: Erik Eliasson <eliasson at it.kth.se>
+ * Johan Bilien <jobi at via.ecp.fr>
+ * Mikael Magnusson <mikma at users.sourceforge.net>
+*/
+
+/* Name
+ * SipDialogresenceClient.cxx
+ * Author
+ * Erik Eliasson, eliasson at it.kth.se
+ * Purpose
+ *
+*/
+#include<config.h>
+
+#include"SipDialogFileTransferClient.h"
+
+#include<libmutil/massert.h>
+#include<libmsip/SipHeaderFrom.h>
+#include<libmsip/SipHeaderTo.h>
+#include<libmsip/SipResponse.h>
+#include<libmsip/SipTransitionUtils.h>
+#include<libmsip/SipDialog.h>
+#include<libmsip/SipCommandString.h>
+#include<libminisip/signaling/sip/DefaultDialogHandler.h>
+#include<libmutil/stringutils.h>
+#include<libmutil/Timestamp.h>
+#include<libmutil/termmanip.h>
+#include<libmutil/dbg.h>
+#include<libmsip/SipSMCommand.h>
+#include <time.h>
+#include<libminisip/gui/LogEntry.h>
+#include<libminisip/media/MediaHandler.h>
+#include<libmutil/MemObject.h>
+#include<libmutil/Thread.h>
+#include<libmsip/SipHeaderSubscriptionState.h>
+#include<libmsip/SipMessageContent.h>
+#include<libmsip/SipMessageContentMime.h>
+#include<libminisip/ipprovider/SimpleIpProvider.h>
+
+#include<libminisip/signaling/sdp/SdpPacket.h>
+
+#include<libminisip/signaling/sdp/SdpHeaderA.h>
+#include<libminisip/signaling/sdp/SdpHeaderM.h>
+
+//#include"../../subsystem_media/msrp/MSRPSender.h"
+
+#include"../../subsystem_media/msrp/MSRPMessage.h"
+
+#ifdef _WIN32_WCE
+# include"../include/minisip_wce_extra_includes.h"
+#endif
+
+using namespace std;
+
+/*
+ Presence dialog for user "user at domain".
+
+ +-------------+
+ | start |
+ +-------------+
+ |
+ | a0: CommandString "INVITE"
+ | new TransactionClient(INVITE)
+a1: V
+ 100 +-------------+
+ +----| trying |--------------+
+ | +-------------+ |
+ | ^ | |
+ | | | a2: 200 OK |
+ +------+ | |
+ V |
+ +-------------+ |
+ +----| transfering | | a4: 4XX message
+ | +-------------+ | sender rejects
+ | | | all files
+ |a3: transp | a5: MSRPDONE |
+ | error | "BYE req" |
+ | V |
+ | +-------------+ |
+ +--->| termwait |<-------------+
+ +-------------+
+ |
+ | a6: no_transactions
+ |
+ V
+ +-------------+
+ | terminated |
+ +-------------+
+
+*/
+
+
+
+bool SipDialogFileTransferClient::a0_start_trying_invite(const SipSMCommand &command){
+
+ if (transitionMatch(command,
+ "start_filetransfer",
+ SipSMCommand::dialog_layer,
+ SipSMCommand::dialog_layer)){
+
+ cerr << "MAFE: State machine got start command - will send INVITE"<<endl;
+ dialogState.remoteUri = command.getCommandString().getParam();
+
+ MRef<SipRequest*> inv;
+ MRef<Session*> mediaSession;
+
+ SimpleIpProvider ipp(phoneConf);
+ string myIp = ipp.getLocalIp();
+ cerr<<"MAFE: local Ip in client: "<<myIp<<endl;
+
+ cerr <<"Remote uri: "<<dialogState.remoteUri<<endl;
+ cerr <<"Contact uri: "<<getDialogConfig()->getContactUri(useSTUN)<<endl;
+
+ inv = SipRequest::createSipMessageInvite(
+ //branch,
+ dialogState.callId,
+ SipUri(dialogState.remoteUri),
+ getDialogConfig()->sipIdentity->getSipUri(),
+ getDialogConfig()->getContactUri(useSTUN),
+ dialogState.seqNo,
+ getSipStack() );
+
+ inv->getHeaderValueFrom()->setParameter("tag",dialogState.localTag);
+
+ MRef<SdpPacket *> sdp = new SdpPacket("v=0\n"
+ "o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com\n");
+ //"m=message 3333 TCP/MSRP *\n"
+ //"a=sendonly\n"
+ //"a=path:msrp://atlanta.example.com:7654/jshAwe:tcp\n");
+ //"a=file-selector:name:\"biggerfile.txt\" type:doc/txt size:32349 hash:sha-1:722EDI65589GRF21\n");
+ //"m=message 7655 TCP/MSRP *\n"
+ //"a=path:msrp://atlanta.example.com:7655/pwnSwe:tcp\n"
+ //"a=file-selector:name:\"My cool video.mpg\" type:video/mpg size:1232349 hash:sha-1:74IEJFRRI566591\n");
+
+ cerr <<"MAFE: files: \n";
+ string name;
+ int i=0;
+
+ //while( (name=command.getCommandString().get("filename"+itoa(i++))," ") != "" ){ *****MULTIPLE FILE TRANSFER*******
+
+ name=command.getCommandString().get("filename"+itoa(i)," ");
+ cerr << " "<< name <<endl;
+
+ MRef<SdpHeaderM *> headerM = new SdpHeaderM("message", 3333, 1, "TCP/MSRP *");
+ MRef<SdpHeaderA *> headerA = new SdpHeaderA("a=file-selector:name:\""+name+"\" type:doc/txt size:3535 hash:sha-1:338448rfhd3\n");
+ headerM->addAttribute(*headerA);
+ MRef<SdpHeader *> headerMnew = dynamic_cast<SdpHeader*>(*headerM);
+ sdp->addHeader(*headerMnew);
+
+ cerr << "MAFE: end of file list"<<endl;
+
+ MRef<SdpHeaderC *> headerC = new SdpHeaderC ("IN", "IP4", myIp);
+ MRef<SdpHeader *> headernew = dynamic_cast<SdpHeader*>(*headerC);
+ sdp->addHeader(headernew);
+
+ inv->setContent( *sdp );
+
+ MRef<SipMessage*>pktr(*inv);
+
+ cerr << "The packet is: "<<endl<<pktr->getString()<<endl;
+ SipSMCommand scmd(
+ pktr,
+ SipSMCommand::dialog_layer,
+ SipSMCommand::transaction_layer
+ );
+
+ getSipStack()->enqueueCommand(scmd, HIGH_PRIO_QUEUE);
+ lastInvite=*inv;
+
+ return true;
+ }else{
+ return false;
+ }
+}
+
+bool SipDialogFileTransferClient::a1_trying_trying_100(const SipSMCommand &command){
+
+ if(transitionMatchSipResponse("INVITE", command, SipSMCommand::transaction_layer, SipSMCommand::dialog_layer, "1**")){
+ dialogState.updateState( MRef<SipResponse*>((SipResponse *)*command.getCommandPacket()) );
+
+ MRef<SipResponse*> resp = (SipResponse*)*command.getCommandPacket();
+ /*if ( resp->requires("100rel") && resp->getStatusCode() !=100){
+ if( !handleRel1xx ( resp ) ){
+ return true;
+ }
+
+ sendPrack(resp);
+ }*/
+ return true;
+ }else{
+ return false;
+ }
+
+}
+
+bool SipDialogFileTransferClient::a2_trying_transfering_200OK(const SipSMCommand &command){
+
+ if (transitionMatch(SipResponse::type, command, SipSMCommand::transaction_layer, SipSMCommand::dialog_layer, "2**")){
+ MRef<SipResponse*> resp( (SipResponse*)*command.getCommandPacket() );
+ dialogState.remoteTag = command.getCommandPacket()->getHeaderValueTo()->getParameter("tag");
+
+ int filesToSend=0;
+ string serveraddr;
+ //resp = command.getCommandPacket();
+
+ MRef<SipMessageContent *> respContent = resp->getContent();
+ MRef<SdpPacket *> respSdp = dynamic_cast<SdpPacket *>(*respContent);
+
+ if(!respSdp){
+ //NOT SDP
+ }else{
+ std::vector<MRef<SdpHeader *> > respHeader = respSdp->getHeaders();
+
+ for(int i=0; i<respHeader.size(); i++){
+
+ MRef<SdpHeader*> one = respHeader[i];
+
+ if(one->getType() == SDP_HEADER_TYPE_C){
+ MRef<SdpHeaderC*> respHeaderC = dynamic_cast<SdpHeaderC*>(*one);
+ serveraddr = respHeaderC->getAddr();
+ }
+
+ else if(one->getType() == SDP_HEADER_TYPE_M){
+ MRef<SdpHeaderM*> respHeaderM = dynamic_cast<SdpHeaderM*>(*one);
+
+ int32_t acceptedPort = respHeaderM->getPort();
+
+ std::list<MRef<SdpHeaderA *> > respHeadersA = respHeaderM->getAttributes();
+ list<MRef<SdpHeaderA *> >::iterator h = respHeadersA.begin();
+
+ while(h != respHeadersA.end()){
+ if((*h)->getAttributeType() == "file-selector"){
+ (*h)->getAttFromFileSelector();
+ if(acceptedPort == 0){
+ //file rejected
+ cerr<<"file: "<<(*h)->filename<<" was rejected for remote user"<<endl;
+ }else{
+ MRef<SipHeaderValueFrom*> from = resp->getHeaderValueFrom();
+
+ //msrp = new MSRPSender...
+ //MRef<Thread .... . .. new Thread(msrp);
+ MRef<Thread*> rpThread = new Thread(new MSRPSender(serveraddr, acceptedPort, (*h)->filename,getSipStack(), dialogState.callId));
+ }
+ }else;
+ h++;
+ }
+ }else;
+ }
+ }
+ sendAck();
+ return true;
+ }else{
+ return false;
+ }
+}
+
+bool SipDialogFileTransferClient::a3_transfering_termwait_transperror(const SipSMCommand &command){
+ if (transitionMatch(command,
+ SipCommandString::transport_error,
+ SipSMCommand::transaction_layer,
+ SipSMCommand::dialog_layer )){
+
+ CommandString cmdstr(dialogState.callId, SipCommandString::transport_error);
+ getSipStack()->getCallback()->handleCommand("gui",cmdstr);
+
+ return true;
+ }else{
+ return false;
+ }
+
+}
+
+bool SipDialogFileTransferClient::a4_trying_termwait_4XX(const SipSMCommand &command){
+
+ if (transitionMatch(SipResponse::type, command, SipSMCommand::transaction_layer, SipSMCommand::dialog_layer, "4**")){
+
+
+ cerr<< "Remote user is rejecting whole transfer"<<endl;
+
+ return true;
+ }else{
+ return false;
+ }
+}
+
+
+bool SipDialogFileTransferClient::a5_transfering_termwait_MSRPDONE(const SipSMCommand &command){
+ if (transitionMatch(command,
+ "MSRP_DONE",
+ SipSMCommand::dialog_layer,
+ SipSMCommand::dialog_layer)){
+
+ sendBye("");
+ CommandString transfer_done(dialogState.callId, "file_transfer_done");
+ getSipStack()->getCallback()->handleCommand("gui", transfer_done);
+/*
+
+ When you create the sender/receiver, pass it the SipStack reference:
+
+ new MSRPSender(...,sipStack, string callId);
+
+ Then in the code you can send commands to the stack by doing
+ CommandString cmd(callId, "MSRP_DONE");
+ sipStack->handleCommand(cmd);
+
+ To tell msrp, you can call a method in msrp from the sip code:
+
+
+*/
+
+ return true;
+ }else{
+ return false;
+ }
+}
+
+
+bool SipDialogFileTransferClient::a6_termwait_terminated_notransactions(const SipSMCommand &command){
+ if (transitionMatch(command,
+ SipCommandString::no_transactions,
+ SipSMCommand::dialog_layer,
+ SipSMCommand::dialog_layer) ){
+
+ dialogState.isTerminated=true;
+
+ SipSMCommand cmd( CommandString( dialogState.callId, SipCommandString::call_terminated),
+ SipSMCommand::dialog_layer,
+ SipSMCommand::dispatcher);
+ getSipStack()->enqueueCommand( cmd, HIGH_PRIO_QUEUE );
+ return true;
+ }else{
+ return false;
+ }
+}
+
+
+void SipDialogFileTransferClient::setUpStateMachine(){
+
+ State<SipSMCommand,string> *s_start = new State<SipSMCommand,string>(this,"start");
+ addState(s_start);
+
+ State<SipSMCommand,string> *s_trying = new State<SipSMCommand,string>(this,"trying");
+ addState(s_trying);
+
+ State<SipSMCommand,string> *s_transfering = new State<SipSMCommand,string>(this,"transfering");
+ addState(s_transfering);
+
+ State<SipSMCommand,string> *s_termwait=new State<SipSMCommand,string>(this,"termwait");
+ addState(s_termwait);
+
+ State<SipSMCommand,string> *s_terminated=new State<SipSMCommand,string>(this,"terminated");
+ addState(s_terminated);
+
+
+ new StateTransition<SipSMCommand,string>(this, "transition_start_trying_invite",
+ (bool (StateMachine<SipSMCommand,string>::*)(const SipSMCommand&)) &SipDialogFileTransferClient::a0_start_trying_invite,
+ s_start, s_trying);
+
+ new StateTransition<SipSMCommand,string>(this, "transition_trying_trying_100",
+ (bool (StateMachine<SipSMCommand,string>::*)(const SipSMCommand&)) &SipDialogFileTransferClient::a1_trying_trying_100,
+ s_trying, s_trying);
+
+ new StateTransition<SipSMCommand,string>(this, "transition_trying_transfering_200OK",
+ (bool (StateMachine<SipSMCommand,string>::*)(const SipSMCommand&)) &SipDialogFileTransferClient::a2_trying_transfering_200OK,
+ s_trying, s_transfering);
+
+ new StateTransition<SipSMCommand,string>(this, "transition_transfering_termwait_transperror",
+ (bool (StateMachine<SipSMCommand,string>::*)(const SipSMCommand&)) &SipDialogFileTransferClient::a3_transfering_termwait_transperror,
+ s_transfering, s_termwait);
+
+ new StateTransition<SipSMCommand,string>(this, "transition_trying_termwait_4XX",
+ (bool (StateMachine<SipSMCommand,string>::*)(const SipSMCommand&)) &SipDialogFileTransferClient::a4_trying_termwait_4XX,
+ s_trying, s_termwait);
+
+ new StateTransition<SipSMCommand,string>(this, "transition_transfering_termwait_MSRPDONE",
+ (bool (StateMachine<SipSMCommand,string>::*)(const SipSMCommand&)) &SipDialogFileTransferClient::a5_transfering_termwait_MSRPDONE,
+ s_transfering, s_termwait);
+
+ new StateTransition<SipSMCommand,string>(this, "transition_termwait_terminated_notransactions",
+ (bool (StateMachine<SipSMCommand,string>::*)(const SipSMCommand&)) &SipDialogFileTransferClient::a6_termwait_terminated_notransactions,
+ s_termwait, s_terminated);
+
+ setCurrentState(s_start);
+}
+
+
+SipDialogFileTransferClient::SipDialogFileTransferClient(MRef<SipStack*> stack,
+ MRef<SipSoftPhoneConfiguration* >pconf,
+ MRef<SipIdentity*> ident,
+ bool use_stun) :
+ SipDialog(stack,ident,""),
+ useSTUN(use_stun),
+ phoneConf(pconf)
+{
+ dialogState.localTag = itoa(rand());
+ //dialogState.remoteUri="mafe at minisip.org";
+
+ setUpStateMachine();
+}
+
+SipDialogFileTransferClient::~SipDialogFileTransferClient(){
+}
+
+void SipDialogFileTransferClient::sendAck(){
+
+ MRef<SipRequest*> lastInvite1 = dynamic_cast<SipRequest*>(*lastInvite);
+ MRef<SipRequest*> ack = createSipMessageAck(lastInvite1);
+
+ SipSMCommand scmd(
+ *ack,
+ SipSMCommand::dialog_layer,
+ SipSMCommand::transport_layer);
+
+ getSipStack()->enqueueCommand(scmd, HIGH_PRIO_QUEUE);
+}
+
+void SipDialogFileTransferClient::sendBye(const string &branch){
+
+ MRef<SipRequest*>bye=createSipMessageBye();
+ MRef<SipMessage*>pref(*bye);
+
+ SipSMCommand cmd(pref, SipSMCommand::dialog_layer, SipSMCommand::transaction_layer);
+ getSipStack()->enqueueCommand(cmd, HIGH_PRIO_QUEUE);
+}
Added: trunk/libminisip/source/subsystem_signaling/sip/SipDialogFileTransferClient.h
===================================================================
--- trunk/libminisip/source/subsystem_signaling/sip/SipDialogFileTransferClient.h (rev 0)
+++ trunk/libminisip/source/subsystem_signaling/sip/SipDialogFileTransferClient.h 2007-06-27 09:36:20 UTC (rev 3336)
@@ -0,0 +1,95 @@
+/*
+ Copyright (C) 2004-2006 the Minisip Team
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* Copyright (C) 2004-2006
+ *
+ * Authors: Erik Eliasson <eliasson at it.kth.se>
+ * Johan Bilien <jobi at via.ecp.fr>
+ * Mikael Magnusson <mikma at users.sourceforge.net>
+*/
+
+/* Name
+ * SipDialogFileTransferClient.h
+ * Author
+ * Erik Eliasson, eliasson at it.kth.se
+ * Purpose
+ *
+*/
+
+#ifndef SipDialogFileTransferClient_H
+#define SipDialogFileTransferClient_H
+
+#include<libminisip/libminisip_config.h>
+
+#include<libmutil/StateMachine.h>
+
+#include<libmsip/SipDialog.h>
+#include<libmsip/SipResponse.h>
+
+#include<libminisip/signaling/sip/SipSoftPhoneConfiguration.h>
+
+//#include"../../subsystem_media/msrp/MSRPSender.h"
+
+#include"../../subsystem_media/msrp/MSRPMessage.h"
+
+class Session;
+class SipDialogContainer;
+class SipDialogConfig;
+class LogEntry;
+
+class LIBMINISIP_API SipDialogFileTransferClient: public SipDialog{
+ public:
+ SipDialogFileTransferClient(MRef<SipStack*> stack, MRef<SipSoftPhoneConfiguration*> pconf, MRef<SipIdentity*> ident, bool use_stun);
+
+ virtual ~SipDialogFileTransferClient();
+
+ virtual std::string getMemObjectType() const {return "SipDialogFileTransferClient";}
+
+ virtual std::string getName(){return "SipDialogFileTransferClient[callid="+dialogState.callId +"]";}
+
+
+ //virtual bool handleCommand(const SipSMCommand &command);
+
+ void setUpStateMachine();
+ void sendAck();
+ void sendBye(const std::string &branch);
+
+ private:
+
+ //void sendSubscribe(const std::string &branch);
+ //void sendNotifyOk(MRef<SipRequest*> notify);
+ //void createSubscribeClientTransaction();
+
+ bool a0_start_trying_invite(const SipSMCommand &command);
+ bool a1_trying_trying_100(const SipSMCommand &command);
+ bool a2_trying_transfering_200OK(const SipSMCommand &command);
+ bool a3_transfering_termwait_transperror(const SipSMCommand &command);
+ bool a4_trying_termwait_4XX(const SipSMCommand &command);
+ bool a5_transfering_termwait_MSRPDONE(const SipSMCommand &command);
+ bool a6_termwait_terminated_notransactions(const SipSMCommand &command);
+
+ MRef<SipRequest*> lastInvite;
+ MRef<SipIdentity *> toUri;
+ bool useSTUN;
+
+ MRef<MSRPSender*> msrpSender;
+
+ MRef<SipSoftPhoneConfiguration*> phoneConf;
+};
+
+#endif
Added: trunk/libminisip/source/subsystem_signaling/sip/SipDialogFileTransferServer.cxx
===================================================================
--- trunk/libminisip/source/subsystem_signaling/sip/SipDialogFileTransferServer.cxx (rev 0)
+++ trunk/libminisip/source/subsystem_signaling/sip/SipDialogFileTransferServer.cxx 2007-06-27 09:36:20 UTC (rev 3336)
@@ -0,0 +1,388 @@
+/*
+ Copyright (C) 2004-2006 the Minisip Team
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* Copyright (C) 2004
+ *
+ * Authors: Erik Eliasson <eliasson at it.kth.se>
+ * Johan Bilien <jobi at via.ecp.fr>
+*/
+
+/* Name
+ * SipDialogFileTransferServer.cxx
+ * Author
+ * Erik Eliasson, eliasson at it.kth.se
+ * Purpose
+ *
+*/
+
+#include<config.h>
+
+#include"SipDialogFileTransferServer.h"
+#include<libmsip/SipHeaderFrom.h>
+#include<libmsip/SipHeaderTo.h>
+#include<libmsip/SipResponse.h>
+#include<libmsip/SipTransitionUtils.h>
+#include<libmsip/SipDialog.h>
+#include<libmsip/SipCommandString.h>
+#include<libminisip/signaling/sip/DefaultDialogHandler.h>
+#include<libmutil/stringutils.h>
+#include<libmutil/Timestamp.h>
+#include<libmutil/Thread.h>
+#include<libmutil/termmanip.h>
+#include<libmutil/dbg.h>
+#include<libmsip/SipSMCommand.h>
+#include <time.h>
+#include<libminisip/gui/LogEntry.h>
+#include<libmsip/SipCommandString.h>
+#include<libminisip/media/MediaHandler.h>
+#include<libmutil/MemObject.h>
+#include<libmsip/SipHeaderExpires.h>
+#include<libminisip/signaling/sip/PresenceMessageContent.h>
+#include<libminisip/ipprovider/SimpleIpProvider.h>
+
+#include<libminisip/signaling/sdp/SdpHeaderA.h>
+#include<libminisip/signaling/sdp/SdpHeaderM.h>
+
+#ifdef _WIN32_WCE
+# include"../include/minisip_wce_extra_includes.h"
+#endif
+
+#include"../../subsystem_media/msrp/MSRPMessage.h"
+
+
+using namespace std;
+
+/*
+ Presence dialog for user "user at domain".
+
+ +-------------+
+ | s_start |
+ +-------------+
+ | start_filetransfer_server
+ | a0: receive invite
+ |
+ V
+ +-------------+
+ | trying |------------------------+
+ +-------------+ |
+ | |
+ | |
+ | a1: 200 OK |
+ | |
+ V |
+ +-------------+ |
+ +----| receiving | | a2: 415
+ | +-------------+ | reject whole transfer
+ | | |
+ |a4: | a3: receiving BYE request |
+ |fail | |
+ |report V |
+ | +-------------+ |
+ +--->| term_wait |<-----------------------+
+ +-------------+
+ | a5: no_transactions
+ |
+ V
+ +-------------+
+ | terminated |
+ +-------------+
+*/
+
+bool SipDialogFileTransferServer::a0_start_trying_receiveINVITE(const SipSMCommand &command){
+ if (transitionMatch("INVITE", command, SipSMCommand::transaction_layer, SipSMCommand::dialog_layer)){
+ cerr << "MAFE: GOT INVITE"<<endl;
+
+ // ---------------------------------------------------------------
+ // Ask user for file(s) transfer
+ // ---------------------------------------------------------------
+
+ int incomingfiles=0;
+
+ lastInvite = dynamic_cast<SipRequest*>( *command.getCommandPacket() ) ;
+
+ MRef<SipMessageContent*> content = lastInvite->getContent();
+ MRef<SdpPacket *> sdp = dynamic_cast<SdpPacket*>(*content);
+
+ CommandString ask_User(dialogState.callId, "incoming_filetransfer_accept");
+
+ if (!sdp){
+ //NOT SDP
+ }else{
+ sendTrying();
+
+ std::vector<MRef<SdpHeader*> > header = sdp->getHeaders();
+ for(int i=0; i<header.size(); i++){
+
+ MRef<SdpHeader*> one = header[i];
+ if(one->getType() == SDP_HEADER_TYPE_M){
+ MRef<SdpHeaderM*> headerM = dynamic_cast<SdpHeaderM*>(*one);
+
+ int32_t fileport = headerM->getPort();
+ incomingfiles++;
+
+ std::list<MRef<SdpHeaderA*> > headersA = headerM->getAttributes();
+ list<MRef<SdpHeaderA*> >::iterator h = headersA.begin();
+
+ while(h != headersA.end()){
+ if((*h)->getAttributeType()=="file-selector"){
+ (*h)->getAttFromFileSelector();
+ cerr<< "MAFE: Waiting for user response "<<(*h)->filename<<endl;
+
+ ask_User["filename"+itoa(incomingfiles)]= (*h)->filename;
+
+ }
+ h++;
+ }
+ }
+ }
+
+ }
+
+ getSipStack()->getCallback()->handleCommand("gui", ask_User);
+// CommandString accept (dialogState.callId, SipCommandString::accept_invite);
+// SipSMCommand sipcmd (accept, SipSMCommand::dialog_layer, SipSMCommand::dialog_layer);
+// getSipStack()->enqueueCommand(sipcmd,HIGH_PRIO_QUEUE);
+
+ return true;
+ }else{
+ return false;
+ }
+}
+
+bool SipDialogFileTransferServer::a1_trying_receiving_accept(const SipSMCommand &command){
+ if (transitionMatch(command,
+ "accept_file_transfer",
+ SipSMCommand::dialog_layer,
+ SipSMCommand::dialog_layer)){
+
+ MRef<SipResponse*> ok = new SipResponse(200, "OK", lastInvite);
+ ok->getHeaderValueTo()-> setParameter("tag", dialogState.localTag);
+
+ SimpleIpProvider ipp(phoneConf);
+ string myIp = ipp.getLocalIp();
+ cerr <<"MAFE: local ip: "<< myIp<<endl;
+
+ string fileNameRecv;
+ int fileSizeRecv;
+
+ MRef<SdpPacket *> sdpAux = new SdpPacket("v=0\n"
+ "o=bob 2890844526 2890844526 IN IP4 bobpc.example.com\n"
+ "s=\n"
+ "t= 0 0\n");
+
+ MRef<SdpHeaderC *> headerC = new SdpHeaderC ("IN", "IP4", myIp);
+ MRef<SdpHeader*> headerNew = dynamic_cast<SdpHeader*>(*headerC);
+ sdpAux->addHeader(headerNew);
+
+ MRef<SipMessageContent*> contentInv = lastInvite->getContent();
+ MRef<SdpPacket *> lastSdp = dynamic_cast<SdpPacket*>(*contentInv);
+
+ std::vector<MRef<SdpHeader*> > headers = lastSdp->getHeaders();
+ for(int i=0; i<headers.size(); i++){
+
+ MRef<SdpHeader*> oneHeader = headers[i];
+
+ if(oneHeader->getType() == SDP_HEADER_TYPE_M){
+
+ sdpAux->addHeader(oneHeader);
+ MRef<SdpHeaderM*> headerM = dynamic_cast<SdpHeaderM*>(*oneHeader);
+
+ std::list<MRef<SdpHeaderA*> > headersA = headerM->getAttributes();
+ list<MRef<SdpHeaderA*> >::iterator h = headersA.begin();
+
+ while(h != headersA.end()){
+ if((*h)->getAttributeType()=="file-selector"){
+ (*h)->getAttFromFileSelector();
+ fileNameRecv = (*h)->filename;
+ fileSizeRecv =atoi(((*h)->filesizes.c_str()));
+ } h++;
+ }
+ }
+ }
+ ok->setContent(*sdpAux);
+
+ MRef<SipMessage*>pref(*ok);
+ SipSMCommand cmd(pref, SipSMCommand::dialog_layer, SipSMCommand::transaction_layer);
+ getSipStack()->enqueueCommand(cmd, HIGH_PRIO_QUEUE);
+
+ MRef<Thread*> rcvThread = new Thread(new MSRPReceiver(fileNameRecv, fileSizeRecv));
+ return true;
+ }else{
+ return false;
+ }
+}
+
+bool SipDialogFileTransferServer::a2_trying_termwait_rejecttransfer(const SipSMCommand &command){
+ if (transitionMatch(command,
+ SipCommandString::reject_invite,
+ SipSMCommand::dialog_layer,
+ SipSMCommand::dialog_layer)){
+
+ sendReject("");
+ return true;
+ }else{
+ return false;
+ }
+}
+
+bool SipDialogFileTransferServer::a3_receiving_termwait_BYE(const SipSMCommand &command){
+ if (transitionMatch("BYE",
+ command,
+ SipSMCommand::transaction_layer,
+ SipSMCommand::dialog_layer)){
+
+ MRef<SipRequest*>bye = (SipRequest*) *command.getCommandPacket();
+ sendByeOk(bye, "");
+ return true;
+ }else{
+ return false;
+ }
+
+}
+
+bool SipDialogFileTransferServer::a4_receiving_termwait_failedtransfer(const SipSMCommand &command){
+ if(transitionMatch("Failed_Transfer",
+ command,
+ SipSMCommand::dialog_layer,
+ SipSMCommand::dialog_layer)){
+
+ sendFailureReport("");
+
+ return true;
+ }else{
+ return false;
+ }
+
+}
+
+bool SipDialogFileTransferServer::a5_termwait_terminated_notransactions(const SipSMCommand &command){
+ if (transitionMatch(command,
+ SipCommandString::no_transactions,
+ SipSMCommand::dialog_layer,
+ SipSMCommand::dialog_layer) ){
+
+ dialogState.isTerminated=true;
+
+ SipSMCommand cmd( CommandString( dialogState.callId, SipCommandString::call_terminated), //FIXME: callId is ""
+ SipSMCommand::dialog_layer,
+ SipSMCommand::dispatcher);
+ getSipStack()->enqueueCommand( cmd, HIGH_PRIO_QUEUE);
+ return true;
+ }else{
+ return false;
+ }
+}
+
+
+void SipDialogFileTransferServer::setUpStateMachine(){
+
+ State<SipSMCommand,string> *s_start = new State<SipSMCommand,string>(this,"start");
+ addState(s_start);
+
+ State<SipSMCommand,string> *s_trying = new State<SipSMCommand,string>(this,"trying");
+ addState(s_trying);
+
+ State<SipSMCommand,string> *s_receiving = new State<SipSMCommand,string>(this,"receiving");
+ addState(s_receiving);
+
+ State<SipSMCommand,string> *s_termwait = new State<SipSMCommand,string>(this,"termwait");
+ addState(s_termwait);
+
+ State<SipSMCommand,string> *s_terminated = new State<SipSMCommand,string>(this,"terminated");
+ addState(s_terminated);
+
+
+ new StateTransition<SipSMCommand,string>(this, "transition_start_trying_receiveINVITE",
+ (bool (StateMachine<SipSMCommand,string>::*)(const SipSMCommand&)) &SipDialogFileTransferServer::a0_start_trying_receiveINVITE,
+ s_start, s_trying);
+
+ new StateTransition<SipSMCommand,string>(this, "transition_trying_receiving_accept",
+ (bool (StateMachine<SipSMCommand,string>::*)(const SipSMCommand&)) &SipDialogFileTransferServer::a1_trying_receiving_accept,
+ s_trying, s_receiving);
+
+ new StateTransition<SipSMCommand,string>(this, "transition_trying_termwait_rejecttransfer",
+ (bool (StateMachine<SipSMCommand,string>::*)(const SipSMCommand&)) &SipDialogFileTransferServer::a2_trying_termwait_rejecttransfer,
+ s_trying, s_termwait);
+
+ new StateTransition<SipSMCommand,string>(this, "transition_receiving_termwait_BYE",
+ (bool (StateMachine<SipSMCommand,string>::*)(const SipSMCommand&)) &SipDialogFileTransferServer::a3_receiving_termwait_BYE,
+ s_receiving, s_termwait);
+
+ new StateTransition<SipSMCommand,string>(this, "transition_receiving_termwait_failedtransfer",
+ (bool (StateMachine<SipSMCommand,string>::*)(const SipSMCommand&)) &SipDialogFileTransferServer::a4_receiving_termwait_failedtransfer,
+ s_receiving, s_termwait);
+
+ new StateTransition<SipSMCommand,string>(this, "transition_termwait_terminated_notransactions",
+ (bool (StateMachine<SipSMCommand,string>::*)(const SipSMCommand&)) &SipDialogFileTransferServer::a5_termwait_terminated_notransactions,
+ s_termwait, s_terminated);
+
+ setCurrentState(s_start);
+}
+
+
+SipDialogFileTransferServer::SipDialogFileTransferServer(MRef<SipStack*> stack,
+ MRef<SipSoftPhoneConfiguration* >pconf,
+ MRef<SipIdentity*> ident,
+ bool use_stun,
+ string callId) :
+ SipDialog(stack,ident,callId),
+ phoneConf(pconf)
+{
+ dialogState.localTag=itoa(rand());
+
+ setUpStateMachine();
+}
+
+SipDialogFileTransferServer::~SipDialogFileTransferServer(){
+}
+
+void SipDialogFileTransferServer::sendTrying(){
+
+ MRef<SipResponse*> trying = createSipResponse (lastInvite, 180, "Trying");
+
+ sendSipMessage (*trying);
+
+}
+
+void SipDialogFileTransferServer::sendReject(const string &branch){
+
+ MRef<SipResponse*> rejecting = new SipResponse(415, "File Transfer not accepted", lastInvite);
+ rejecting-> getHeaderValueTo()-> setParameter("tag", dialogState.localTag);
+ MRef<SipMessage*> pref(*rejecting);
+ SipSMCommand cmd(pref, SipSMCommand::dialog_layer, SipSMCommand::transaction_layer);
+ getSipStack()-> enqueueCommand(cmd, HIGH_PRIO_QUEUE);
+}
+
+void SipDialogFileTransferServer::sendFailureReport(const string &branch){
+
+ //---------------------------------
+ //Send MSRP Failure Report
+ //-------------------------------
+
+}
+
+void SipDialogFileTransferServer::sendByeOk(MRef<SipRequest*> bye, const string &branch){
+
+ MRef<SipResponse*> byeOk = new SipResponse(200, "OK", bye);
+ byeOk->getHeaderValueTo()->setParameter("tag",dialogState.localTag);
+
+ MRef<SipMessage*> pref(*byeOk);
+ SipSMCommand cmd(pref, SipSMCommand::dialog_layer, SipSMCommand::transaction_layer);
+ getSipStack()->enqueueCommand(cmd, HIGH_PRIO_QUEUE);
+}
+
Added: trunk/libminisip/source/subsystem_signaling/sip/SipDialogFileTransferServer.h
===================================================================
--- trunk/libminisip/source/subsystem_signaling/sip/SipDialogFileTransferServer.h (rev 0)
+++ trunk/libminisip/source/subsystem_signaling/sip/SipDialogFileTransferServer.h 2007-06-27 09:36:20 UTC (rev 3336)
@@ -0,0 +1,95 @@
+/*
+ Copyright (C) 2004-2006 the Minisip Team
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* Copyright (C) 2004
+ *
+ * Authors: Erik Eliasson <eliasson at it.kth.se>
+ * Johan Bilien <jobi at via.ecp.fr>
+*/
+
+/* Name
+ * SipDialogFileTransferServer.h
+ * Author
+ * Erik Eliasson, eliasson at it.kth.se
+ * Purpose
+ *
+*/
+
+#ifndef SipDialogFileTransferServer_H
+#define SipDialogFileTransferServer_H
+
+#include<libminisip/libminisip_config.h>
+
+#include<libmutil/StateMachine.h>
+#include<libmutil/minilist.h>
+
+#include<libmsip/SipDialog.h>
+#include<libmsip/SipResponse.h>
+
+#include<libminisip/signaling/sip/SipSoftPhoneConfiguration.h>
+
+class Session;
+class SipDialogContainer;
+class SipDialogConfig;
+class LogEntry;
+
+class LIBMINISIP_API SipDialogFileTransferServer: public SipDialog{
+ public:
+ SipDialogFileTransferServer(MRef<SipStack*> dContainer, MRef<SipSoftPhoneConfiguration*> pconf, MRef<SipIdentity*> ident, bool use_stun, std::string callId);
+
+ virtual ~SipDialogFileTransferServer();
+
+ virtual std::string getMemObjectType() const {return "SipDialogFileTransferServer";}
+
+ virtual std::string getName(){return "SipDialogFileTransferServer[callid="+dialogState.callId +"]";}
+
+ //virtual bool handleCommand(const SipSMCommand &command);
+
+ void setUpStateMachine();
+
+ void sendTrying();
+ void sendReject(const std::string &branch);
+ void sendFailureReport(const std::string &branch);
+ void sendByeOk(MRef<SipRequest*>bye, const std::string &branch);
+
+ private:
+ //void sendNoticeToAll( std::string onlineStatus);
+ //void sendNotice( std::string onlinestatus, std::string user);
+ //void sendSubscribeOk(MRef<SipRequest*> sub);
+ //void removeUser( std::string user);
+ //void addUser( std::string user);
+
+ //void sendNotify(const std::string &branch, std::string toUri, std::string callId);
+
+ bool a0_start_trying_receiveINVITE(const SipSMCommand &command);
+ bool a1_trying_receiving_accept(const SipSMCommand &command);
+ bool a2_trying_termwait_rejecttransfer(const SipSMCommand &command);
+ bool a3_receiving_termwait_BYE(const SipSMCommand &command);
+ bool a4_receiving_termwait_failedtransfer(const SipSMCommand &command);
+ bool a5_termwait_terminated_notransactions(const SipSMCommand &command);
+
+ bool useSTUN;
+ //minilist< std::string> subscribing_users;
+ Mutex usersLock;
+
+ std::string onlineStatus;
+ MRef<SipRequest*> lastInvite;
+ MRef<SipSoftPhoneConfiguration*> phoneConf;
+};
+
+#endif
More information about the Minisip-devel
mailing list