Add support for SIP PUBLISH
Add support for 401/407 (challenge) messages in SIP MESSAGE dialogs
This commit is contained in:
parent
30fd2e0f0a
commit
4a0129b4ca
|
@ -40,24 +40,29 @@
|
|||
//-------------------------------------------------------------------------------------
|
||||
Initialized Entry { OnStateChanged(SS_MESSAGE_INITIALIZED); }
|
||||
{
|
||||
sm_messageSent() Trying { }
|
||||
sm_messageSent() Trying { }
|
||||
}
|
||||
|
||||
Trying Entry { OnStateChanged(SS_MESSAGE_TRYING); }
|
||||
{
|
||||
sm_1xx_response() nil {}
|
||||
sm_2xx_response() Terminated {}
|
||||
sm_1xx_response() nil {}
|
||||
sm_2xx_response() Terminated {}
|
||||
sm_401_407_421_494_response() Authentifying {}
|
||||
sm_unsupported_response Terminated { }
|
||||
sm_xxx_response Terminated { }
|
||||
}
|
||||
|
||||
Authentifying Entry { OnStateChanged(SS_MESSAGE_AUTHENTIFYING); }
|
||||
{
|
||||
sm_1xx_response() nil {}
|
||||
sm_2xx_response() Terminated {}
|
||||
sm_xxx_response Terminated { }
|
||||
sm_authentificationSent() Trying {}
|
||||
Default nil {}
|
||||
}
|
||||
|
||||
Terminated Entry { OnStateChanged(SS_MESSAGE_TERMINATED); }
|
||||
{
|
||||
Default nil {}
|
||||
Default nil {}
|
||||
}
|
||||
|
||||
Default Entry { OnStateChanged(SS_MESSAGE_UNKNOWN); }
|
||||
|
|
|
@ -38,15 +38,62 @@
|
|||
//-------------------------------------------------------------------------------------
|
||||
// Initialized
|
||||
//-------------------------------------------------------------------------------------
|
||||
Initialized
|
||||
Entry
|
||||
{
|
||||
}
|
||||
Exit
|
||||
{
|
||||
}
|
||||
//
|
||||
{
|
||||
}
|
||||
Initialized Entry { OnStateChanged(SS_PUBLISH_INITIALIZED); }
|
||||
{
|
||||
sm_publishSent() Trying { }
|
||||
}
|
||||
|
||||
Trying Entry { OnStateChanged(SS_PUBLISH_TRYING); }
|
||||
{
|
||||
sm_1xx_response() nil {}
|
||||
sm_2xx_response(unpub: bool) [unpub == true] Terminated {}
|
||||
sm_2xx_response(unpub: bool) [unpub == false] Established {}
|
||||
sm_3xx_response() Terminated {}
|
||||
sm_401_407_421_494_response() Authentifying {}
|
||||
sm_4xx_response() Terminated {}
|
||||
sm_5xx_response() Terminated {}
|
||||
sm_6xx_response() Terminated {}
|
||||
sm_xxx_response() Terminated {}
|
||||
sm_cancelSent() Terminated {}
|
||||
Default nil {}
|
||||
}
|
||||
|
||||
Established Entry { OnStateChanged(SS_PUBLISH_ESTABLISHED); }
|
||||
{
|
||||
sm_1xx_response() nil {}
|
||||
sm_2xx_response(unpub: bool) [unpub == true] Terminated {}
|
||||
sm_2xx_response(unpub: bool) [unpub == false] nil {}
|
||||
sm_401_407_421_494_response() Authentifying {}
|
||||
sm_unpublishSent() Trying { }
|
||||
sm_publishSent() Trying {}
|
||||
sm_xxx_response() Terminated {}
|
||||
Default nil {}
|
||||
}
|
||||
|
||||
Authentifying Entry { OnStateChanged(SS_PUBLISH_AUTHENTIFYING); }
|
||||
{
|
||||
sm_1xx_response() nil {}
|
||||
sm_2xx_response(unpub: bool) [unpub == true] Terminated {}
|
||||
sm_2xx_response(unpub: bool) [unpub == false] Established {}
|
||||
sm_xxx_response() Terminated {}
|
||||
sm_authentificationSent() Trying {}
|
||||
Default nil {}
|
||||
}
|
||||
|
||||
Terminated Entry { OnStateChanged(SS_PUBLISH_TERMINATED); }
|
||||
{
|
||||
Default nil {}
|
||||
}
|
||||
|
||||
Default Entry { OnStateChanged(SS_PUBLISH_UNKNOWN); }
|
||||
{
|
||||
sm_401_407_421_494_response() Authentifying {}
|
||||
sm_3xx_response() nil {}
|
||||
sm_4xx_response() nil {}
|
||||
sm_5xx_response() nil {}
|
||||
sm_6xx_response() nil {}
|
||||
sm_xxx_response() nil {}
|
||||
Default nil {}
|
||||
}
|
||||
|
||||
%%
|
|
@ -40,37 +40,43 @@
|
|||
//-------------------------------------------------------------------------------------
|
||||
Initialized Entry { OnStateChanged(SS_REGISTER_INITIALIZED); }
|
||||
{
|
||||
sm_registerSent() Trying { set_registering(true); }
|
||||
sm_registerSent() Trying { }
|
||||
}
|
||||
|
||||
Trying Entry { OnStateChanged(SS_REGISTER_TRYING); }
|
||||
{
|
||||
sm_1xx_response() nil {}
|
||||
sm_2xx_response() [ctxt.get_registering() == true] Established {}
|
||||
sm_2xx_response() [ctxt.get_registering() == false] Terminated {}
|
||||
sm_2xx_response(unreg: bool) [unreg == true] Terminated {}
|
||||
sm_2xx_response(unreg: bool) [unreg == false] Established {}
|
||||
sm_3xx_response() Terminated {}
|
||||
sm_401_407_421_494_response() Authentifying {}
|
||||
sm_4xx_response() Terminated {}
|
||||
sm_5xx_response() Terminated {}
|
||||
sm_6xx_response() Terminated {}
|
||||
sm_xxx_response() Terminated {}
|
||||
Default Terminated {}
|
||||
sm_cancelSent() Terminated {}
|
||||
Default nil {}
|
||||
}
|
||||
|
||||
Established Entry { OnStateChanged(SS_REGISTER_ESTABLISHED); }
|
||||
{
|
||||
sm_1xx_response() nil {}
|
||||
sm_2xx_response() nil {}
|
||||
sm_unregisterSent() Trying { set_registering(false); }
|
||||
Default Terminated {}
|
||||
sm_2xx_response(unreg: bool) [unreg == true] Terminated {}
|
||||
sm_2xx_response(unreg: bool) [unreg == false] nil {}
|
||||
sm_401_407_421_494_response() Authentifying {}
|
||||
sm_unregisterSent() Trying { }
|
||||
sm_xxx_response() Terminated {}
|
||||
Default nil {}
|
||||
}
|
||||
|
||||
Authentifying Entry { OnStateChanged(SS_REGISTER_AUTHENTIFYING); }
|
||||
{
|
||||
sm_1xx_response() nil {}
|
||||
sm_2xx_response() [ctxt.get_registering() == true] Established {}
|
||||
sm_2xx_response(unreg: bool) [unreg == true] Terminated {}
|
||||
sm_2xx_response(unreg: bool) [unreg == false] Established {}
|
||||
sm_xxx_response() Terminated {}
|
||||
sm_authentificationSent() Trying {}
|
||||
Default Terminated {}
|
||||
Default nil {}
|
||||
}
|
||||
|
||||
Terminated Entry { OnStateChanged(SS_REGISTER_TERMINATED); }
|
||||
|
@ -78,15 +84,15 @@ Terminated Entry { OnStateChanged(SS_REGISTER_TERMINATED); }
|
|||
Default nil {}
|
||||
}
|
||||
|
||||
//Default Entry { OnStateChanged(SS_REGISTER_UNKNOWN); }
|
||||
//{
|
||||
// sm_401_407_421_494_response() Authentifying {}
|
||||
// sm_3xx_response() nil {}
|
||||
// sm_4xx_response() nil {}
|
||||
// sm_5xx_response() nil {}
|
||||
// sm_6xx_response() nil {}
|
||||
// sm_xxx_response() nil {}
|
||||
// Default nil {}
|
||||
//}
|
||||
|
||||
Default Entry { OnStateChanged(SS_REGISTER_UNKNOWN); }
|
||||
{
|
||||
sm_401_407_421_494_response() Authentifying {}
|
||||
sm_3xx_response() nil {}
|
||||
sm_4xx_response() nil {}
|
||||
sm_5xx_response() nil {}
|
||||
sm_6xx_response() nil {}
|
||||
sm_xxx_response() nil {}
|
||||
Default nil {}
|
||||
}
|
||||
|
||||
%%
|
|
@ -39,13 +39,31 @@ ERR sip_unregister(int stack_id)
|
|||
// sip MESSAGE
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/* send sip register message */
|
||||
/* send sip MESSAGE request */
|
||||
ERR sip_message(int stack_id, const char* dest_address, const char* content_type, const char* content)
|
||||
{
|
||||
GET_STACK(stack_id, stk);
|
||||
return stk->sip_message(dest_address, content_type, content);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// sip PUBLISH
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/* send sip PUBLISH request */
|
||||
ERR sip_publish(int stack_id)
|
||||
{
|
||||
GET_STACK(stack_id, stk);
|
||||
return stk->sip_publish();
|
||||
}
|
||||
|
||||
/* send sip UNPUBLISH request*/
|
||||
ERR sip_unpublish(int stack_id)
|
||||
{
|
||||
GET_STACK(stack_id, stk);
|
||||
return stk->sip_unpublish();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// authentication
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -17,6 +17,12 @@ DOUBANGO_API_C ERR sip_unregister(int stack_id);
|
|||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
DOUBANGO_API_C ERR sip_message(int stack_id, const char* dest_address, const char* content_type, const char* content);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// sip PUBLISH
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
DOUBANGO_API_C ERR sip_publish(int stack_id);
|
||||
DOUBANGO_API_C ERR sip_unpublish(int stack_id);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// authentication
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -17,6 +17,14 @@ typedef enum tag_SIP_STATE
|
|||
SS_REGISTER_ESTABLISHED,
|
||||
SS_REGISTER_TERMINATED,
|
||||
|
||||
/* PUBLISH */
|
||||
SS_PUBLISH_UNKNOWN,
|
||||
SS_PUBLISH_INITIALIZED,
|
||||
SS_PUBLISH_TRYING,
|
||||
SS_PUBLISH_AUTHENTIFYING,
|
||||
SS_PUBLISH_ESTABLISHED,
|
||||
SS_PUBLISH_TERMINATED,
|
||||
|
||||
/* MESSAGE */
|
||||
SS_MESSAGE_UNKNOWN,
|
||||
SS_MESSAGE_INITIALIZED,
|
||||
|
|
|
@ -70,6 +70,8 @@ public:
|
|||
|
||||
ERR sip_message(const char* dest_address, const char* content_type, const char* content);
|
||||
|
||||
ERR sip_publish();
|
||||
ERR sip_unpublish();
|
||||
|
||||
//
|
||||
// Authentication
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "api_stack.h"
|
||||
#include "sip_dialog_register.h"
|
||||
#include "sip_dialog_message.h"
|
||||
//#include<sofia-sip/auth_module.h>
|
||||
#include "sip_dialog_publish.h"
|
||||
|
||||
PREF_NAMESPACE_START
|
||||
|
||||
|
@ -10,7 +10,7 @@ ERR stack::sip_register()
|
|||
{
|
||||
GET_DIALOG_BY_SIPMETHOD(dlg, "REGISTER");
|
||||
if(dlg){
|
||||
return ((sip_dialog_register*)dlg)->Start();
|
||||
return dlg->Start();
|
||||
}
|
||||
else{
|
||||
sip_dialog_register* dlg_register = new sip_dialog_register(this);
|
||||
|
@ -24,7 +24,7 @@ ERR stack::sip_unregister()
|
|||
{
|
||||
GET_DIALOG_BY_SIPMETHOD(dlg, "REGISTER");
|
||||
if(dlg){
|
||||
return ((sip_dialog_register*)dlg)->Stop();
|
||||
return dlg->Stop();
|
||||
}
|
||||
else return ERR_SIP_DIALOG_NOT_FOUND;
|
||||
}
|
||||
|
@ -37,5 +37,28 @@ ERR stack::sip_message(const char* dest_address, const char* content_type, const
|
|||
return dlg_message->Start();
|
||||
}
|
||||
|
||||
/* SIP PUBLISH */
|
||||
ERR stack::sip_publish()
|
||||
{
|
||||
GET_DIALOG_BY_SIPMETHOD(dlg, "PUBLISH");
|
||||
if(dlg){
|
||||
return dlg->Start();
|
||||
}
|
||||
else{
|
||||
sip_dialog_publish* dlg_publish = new sip_dialog_publish(this);
|
||||
this->dialogs.push_back(dlg_publish);
|
||||
return dlg_publish->Start();
|
||||
}
|
||||
}
|
||||
|
||||
/* SIP UNPUBLISH*/
|
||||
ERR stack::sip_unpublish()
|
||||
{
|
||||
GET_DIALOG_BY_SIPMETHOD(dlg, "PUBLISH");
|
||||
if(dlg){
|
||||
return dlg->Stop();
|
||||
}
|
||||
else return ERR_SIP_DIALOG_NOT_FOUND;
|
||||
}
|
||||
|
||||
PREF_NAMESPACE_END
|
|
@ -55,9 +55,10 @@ void sip_dialog::OnStateChanged(SIP_STATE state)
|
|||
/* authenticate the supplied request*/
|
||||
void sip_dialog::authenticate(nua_handle_t *nh, sip_t const *sip)
|
||||
{
|
||||
const char* realm = msg_params_find(sip->sip_www_authenticate->au_params, "realm=");
|
||||
const char* realm = sip->sip_www_authenticate?
|
||||
msg_params_find(sip->sip_www_authenticate->au_params, "realm="): (sip->sip_proxy_authenticate ? msg_params_find(sip->sip_proxy_authenticate->au_params, "realm="): "UNKNOWN");
|
||||
const char* scheme = sip->sip_www_authenticate?
|
||||
sip->sip_www_authenticate->au_scheme: (sip->sip_proxy_authenticate ? sip->sip_proxy_authenticate->au_scheme : "UNKNOWN");
|
||||
sip->sip_www_authenticate->au_scheme: (sip->sip_proxy_authenticate ? sip->sip_proxy_authenticate->au_scheme: "UNKNOWN");
|
||||
|
||||
char* authstring = su_sprintf(NULL, "%s:%s:%s:%s",
|
||||
scheme, realm, this->stk->get_private_id(), this->stk->get_password());
|
||||
|
|
|
@ -50,6 +50,8 @@ sip_dialog_message::~sip_dialog_message()
|
|||
/* start sending MESSAGE */
|
||||
ERR sip_dialog_message::Start()
|
||||
{
|
||||
this->sm_ctx.enterStartState();
|
||||
|
||||
this->handle = nua_handle(this->stk->get_nua(), this->stk->get_home(), TAG_END());
|
||||
|
||||
if(!this->handle)
|
||||
|
@ -57,16 +59,7 @@ ERR sip_dialog_message::Start()
|
|||
return ERR_GLOBAL_FAILURE;
|
||||
}
|
||||
|
||||
nua_message(this->handle,
|
||||
SIPTAG_TO_STR(this->dest_address),
|
||||
SIPTAG_FROM_STR(this->stk->get_public_id()),
|
||||
SIPTAG_CONTENT_TYPE_STR(this->content_type),
|
||||
SIPTAG_PAYLOAD_STR(this->content),
|
||||
TAG_END());
|
||||
|
||||
this->sm_ctx.sm_messageSent();
|
||||
|
||||
return ERR_SUCCESS;
|
||||
return this->sendMessage();
|
||||
}
|
||||
|
||||
/* terminate/stop dialog */
|
||||
|
@ -87,6 +80,23 @@ inline const char* sip_dialog_message::get_sipmethod()const
|
|||
return "MESSAGE";
|
||||
}
|
||||
|
||||
/* send sip MESSAGE request*/
|
||||
ERR sip_dialog_message::sendMessage()
|
||||
{
|
||||
if(!this->handle) return ERR_SIP_DIALOG_UNKNOWN;
|
||||
|
||||
nua_message(this->handle,
|
||||
SIPTAG_TO_STR(this->dest_address),
|
||||
SIPTAG_FROM_STR(this->stk->get_public_id()),
|
||||
SIPTAG_CONTENT_TYPE_STR(this->content_type),
|
||||
SIPTAG_PAYLOAD_STR(this->content),
|
||||
TAG_END());
|
||||
|
||||
this->sm_ctx.sm_messageSent();
|
||||
|
||||
return ERR_SUCCESS;
|
||||
}
|
||||
|
||||
/* returns true if terminated and false otherwise*/
|
||||
inline bool sip_dialog_message::get_terminated()const
|
||||
{
|
||||
|
@ -107,8 +117,13 @@ void sip_dialog_message::dialog_callback(nua_event_t _event,
|
|||
{
|
||||
if(status <200) this->sm_ctx.sm_1xx_response();
|
||||
else if(status <300) this->sm_ctx.sm_2xx_response();
|
||||
else if(status == 401 || status == 407 || status == 421 || status == 494) this->sm_ctx.sm_401_407_421_494_response();
|
||||
else this->sm_ctx.sm_unsupported_response();
|
||||
else if(status == 401 || status == 407 || status == 421 || status == 494)
|
||||
{
|
||||
this->sm_ctx.sm_401_407_421_494_response();
|
||||
this->authenticate(nh, sip);
|
||||
this->sm_ctx.sm_authentificationSent();
|
||||
}
|
||||
else this->sm_ctx.sm_xxx_response();
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ public:
|
|||
|
||||
private:
|
||||
sip_dialog_messageContext sm_ctx;
|
||||
ERR sendMessage();
|
||||
|
||||
char* dest_address;
|
||||
char* content_type;
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
*
|
||||
*/
|
||||
#include "sip_dialog_publish.h"
|
||||
#include "api_stack.h"
|
||||
|
||||
#include <sofia-sip/sip_protos.h>
|
||||
|
||||
PREF_NAMESPACE_START
|
||||
|
||||
|
@ -39,4 +42,153 @@ sip_dialog_publish::~sip_dialog_publish()
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
/* start */
|
||||
ERR sip_dialog_publish::Start()
|
||||
{
|
||||
this->sm_ctx.enterStartState();
|
||||
|
||||
this->handle = nua_handle(this->stk->get_nua(), this->stk->get_home(),
|
||||
SIPTAG_TO_STR(this->stk->get_realm()), TAG_END());
|
||||
|
||||
if(!this->handle)
|
||||
{
|
||||
return ERR_GLOBAL_FAILURE;
|
||||
}
|
||||
|
||||
return this->sendPublish();
|
||||
}
|
||||
|
||||
/* stop */
|
||||
ERR sip_dialog_publish::Stop()
|
||||
{
|
||||
ERR err = (this->state_current == SS_PUBLISH_ESTABLISHED) ?
|
||||
this->sendUnpublish() : this->sendCancel();
|
||||
return err;
|
||||
}
|
||||
|
||||
/* state changed */
|
||||
void sip_dialog_publish::OnStateChanged(SIP_STATE state)
|
||||
{
|
||||
sip_dialog::OnStateChanged(state);
|
||||
#if 1
|
||||
if(this->get_terminated())
|
||||
{
|
||||
printf("PUBLISH terminated\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* sip method name */
|
||||
inline const char* sip_dialog_publish::get_sipmethod()const
|
||||
{
|
||||
return "PUBLISH";
|
||||
}
|
||||
|
||||
/* returns true if terminated and false otherwise*/
|
||||
inline bool sip_dialog_publish::get_terminated()const
|
||||
{
|
||||
return (this->state_current == SS_PUBLISH_TERMINATED);
|
||||
}
|
||||
|
||||
/* send SIP PUBLISH request */
|
||||
ERR sip_dialog_publish::sendPublish()
|
||||
{
|
||||
if(!this->handle) return ERR_SIP_DIALOG_UNKNOWN;
|
||||
|
||||
bool open = true;
|
||||
const char* note = "my dummy note(FIXME)";
|
||||
char* xmlnote = su_sprintf(NULL, "<note>%s</note>\n", note);
|
||||
|
||||
sip_payload_t *pl = sip_payload_format(NULL,
|
||||
"<?xml version='1.0' encoding='UTF-8'?>\n"
|
||||
"<presence xmlns='urn:ietf:params:xml:ns:cpim-pidf'\n"
|
||||
" entity='%s'>\n"
|
||||
" <tuple id='%s'>\n"
|
||||
" <status><basic>%s</basic></status>\n"
|
||||
"%s"
|
||||
" </tuple>\n"
|
||||
"</presence>\n",
|
||||
this->stk->get_public_id(), "FIXME",
|
||||
open ? "open" : "closed",
|
||||
xmlnote ? xmlnote : "");
|
||||
|
||||
nua_publish(this->handle, SIPTAG_PAYLOAD(pl),
|
||||
NUTAG_M_USERNAME("FIXME"),
|
||||
SIPTAG_PRIVACY_STR(this->stk->get_privacy()),
|
||||
SIPTAG_FROM_STR(this->stk->get_public_id()),
|
||||
SIPTAG_TO_STR(this->stk->get_public_id()),
|
||||
NUTAG_M_FEATURES("expires=200"),// FIXME
|
||||
SIPTAG_EVENT_STR("presence"),
|
||||
TAG_IF(pl, SIPTAG_CONTENT_TYPE_STR("application/cpim-pidf+xml")),
|
||||
TAG_END());
|
||||
|
||||
this->sm_ctx.sm_publishSent();
|
||||
su_free(NULL, pl);
|
||||
|
||||
return ERR_SUCCESS;
|
||||
}
|
||||
|
||||
/* send SIP UNPUBLISH request*/
|
||||
ERR sip_dialog_publish::sendUnpublish()
|
||||
{
|
||||
if(this->handle)
|
||||
{
|
||||
nua_unpublish(this->handle, TAG_END());
|
||||
this->sm_ctx.sm_unpublishSent();
|
||||
|
||||
return ERR_SUCCESS;
|
||||
}
|
||||
else return ERR_SIP_DIALOG_UNKNOWN;
|
||||
}
|
||||
|
||||
/* cancel request */
|
||||
ERR sip_dialog_publish::sendCancel()
|
||||
{
|
||||
if(this->handle)
|
||||
{
|
||||
nua_cancel(this->handle, TAG_END());
|
||||
this->sm_ctx.sm_cancelSent();
|
||||
|
||||
return ERR_SUCCESS;
|
||||
}
|
||||
else return ERR_SIP_DIALOG_UNKNOWN;
|
||||
}
|
||||
|
||||
/* dialog callback function*/
|
||||
void sip_dialog_publish::dialog_callback(nua_event_t _event,
|
||||
int status, char const *phrase,
|
||||
nua_t *nua, nua_magic_t *magic,
|
||||
nua_handle_t *nh, nua_hmagic_t *hmagic,
|
||||
sip_t const *sip,
|
||||
tagi_t tags[])
|
||||
{
|
||||
switch(_event)
|
||||
{
|
||||
case nua_r_publish:
|
||||
case nua_r_unpublish:
|
||||
{
|
||||
if(status <200) this->sm_ctx.sm_1xx_response();
|
||||
else if(status <300) this->sm_ctx.sm_2xx_response( (_event==nua_r_unpublish) );
|
||||
else if(status <400) this->sm_ctx.sm_3xx_response();
|
||||
else if(status == 401 || status == 407 || status == 421 || status == 494)
|
||||
{
|
||||
this->sm_ctx.sm_401_407_421_494_response();
|
||||
this->authenticate(nh, sip);
|
||||
this->sm_ctx.sm_authentificationSent();
|
||||
}
|
||||
else if(status<500) this->sm_ctx.sm_4xx_response();
|
||||
else if(status<600) this->sm_ctx.sm_5xx_response();
|
||||
else if(status<700) this->sm_ctx.sm_6xx_response();
|
||||
else this->sm_ctx.sm_xxx_response();
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PREF_NAMESPACE_END
|
|
@ -41,6 +41,23 @@ public:
|
|||
sip_dialog_publish(stack* stk);
|
||||
~sip_dialog_publish();
|
||||
|
||||
/* sip_dialog override*/
|
||||
ERR Start();
|
||||
ERR Stop();
|
||||
void OnStateChanged(SIP_STATE state);
|
||||
inline const char* get_sipmethod()const;
|
||||
inline bool get_terminated()const;
|
||||
void dialog_callback(nua_event_t event,
|
||||
int status, char const *phrase,
|
||||
nua_t *nua, nua_magic_t *magic,
|
||||
nua_handle_t *nh, nua_hmagic_t *hmagic,
|
||||
sip_t const *sip,
|
||||
tagi_t tags[]);
|
||||
private:
|
||||
ERR sendPublish();
|
||||
ERR sendUnpublish();
|
||||
ERR sendCancel();
|
||||
|
||||
private:
|
||||
sip_dialog_publishContext sm_ctx;
|
||||
};
|
||||
|
|
|
@ -61,7 +61,8 @@ ERR sip_dialog_register::Start()
|
|||
/* stop */
|
||||
ERR sip_dialog_register::Stop()
|
||||
{
|
||||
ERR err = this->sendUnregister();
|
||||
ERR err = (this->state_current == SS_REGISTER_ESTABLISHED) ?
|
||||
this->sendUnregister() : this->sendCancel();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -69,6 +70,12 @@ ERR sip_dialog_register::Stop()
|
|||
void sip_dialog_register::OnStateChanged(SIP_STATE state)
|
||||
{
|
||||
sip_dialog::OnStateChanged(state);
|
||||
#if 0
|
||||
if(this->get_terminated())
|
||||
{
|
||||
printf("REGISTER terminated\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* sip method name */
|
||||
|
@ -98,11 +105,10 @@ ERR sip_dialog_register::sendRegister()
|
|||
NUTAG_OUTBOUND("no-options-keepalive"),
|
||||
NUTAG_OUTBOUND("no-validate"),
|
||||
NUTAG_KEEPALIVE(0),
|
||||
SIPTAG_EXPIRES_STR("20"),
|
||||
NUTAG_M_FEATURES("audio;expires=200;+g.3gpp.cs-voice"),// FIXME
|
||||
NUTAG_M_USERNAME("FIXME"),
|
||||
SIPTAG_FROM_STR(this->stk->get_public_id()),
|
||||
SIPTAG_TO_STR(this->stk->get_public_id()),
|
||||
NUTAG_M_FEATURES("audio"),
|
||||
NUTAG_CALLEE_CAPS(0),
|
||||
SIPTAG_SUPPORTED_STR("timer, precondition, path, replaces, 100rel, gruu"),
|
||||
SIPTAG_EVENT_STR("registration"),
|
||||
|
@ -132,6 +138,19 @@ ERR sip_dialog_register::sendUnregister()
|
|||
else return ERR_SIP_DIALOG_UNKNOWN;
|
||||
}
|
||||
|
||||
/* cancel request */
|
||||
ERR sip_dialog_register::sendCancel()
|
||||
{
|
||||
if(this->handle)
|
||||
{
|
||||
nua_cancel(this->handle, TAG_END());
|
||||
this->sm_ctx.sm_cancelSent();
|
||||
|
||||
return ERR_SUCCESS;
|
||||
}
|
||||
else return ERR_SIP_DIALOG_UNKNOWN;
|
||||
}
|
||||
|
||||
/* dialog callback function*/
|
||||
void sip_dialog_register::dialog_callback(nua_event_t _event,
|
||||
int status, char const *phrase,
|
||||
|
@ -146,7 +165,7 @@ void sip_dialog_register::dialog_callback(nua_event_t _event,
|
|||
case nua_r_unregister:
|
||||
{
|
||||
if(status <200) this->sm_ctx.sm_1xx_response();
|
||||
else if(status <300) this->sm_ctx.sm_2xx_response();
|
||||
else if(status <300) this->sm_ctx.sm_2xx_response( (_event==nua_r_unregister) );
|
||||
else if(status <400) this->sm_ctx.sm_3xx_response();
|
||||
else if(status == 401 || status == 407 || status == 421 || status == 494)
|
||||
{
|
||||
|
|
|
@ -53,18 +53,13 @@ public:
|
|||
nua_handle_t *nh, nua_hmagic_t *hmagic,
|
||||
sip_t const *sip,
|
||||
tagi_t tags[]);
|
||||
|
||||
|
||||
bool get_registering() { return this->registering; }
|
||||
void set_registering(bool val) { this->registering = val; }
|
||||
|
||||
private:
|
||||
ERR sendRegister();
|
||||
ERR sendUnregister();
|
||||
ERR sendCancel();
|
||||
|
||||
private:
|
||||
sip_dialog_registerContext sm_ctx;
|
||||
bool registering;
|
||||
};
|
||||
|
||||
PREF_NAMESPACE_END
|
||||
|
|
|
@ -65,13 +65,19 @@ namespace dgo
|
|||
return;
|
||||
}
|
||||
|
||||
void sip_dialog_messageState::sm_authentificationSent(sip_dialog_messageContext& context)
|
||||
{
|
||||
Default(context);
|
||||
return;
|
||||
}
|
||||
|
||||
void sip_dialog_messageState::sm_messageSent(sip_dialog_messageContext& context)
|
||||
{
|
||||
Default(context);
|
||||
return;
|
||||
}
|
||||
|
||||
void sip_dialog_messageState::sm_unsupported_response(sip_dialog_messageContext& context)
|
||||
void sip_dialog_messageState::sm_xxx_response(sip_dialog_messageContext& context)
|
||||
{
|
||||
Default(context);
|
||||
return;
|
||||
|
@ -156,7 +162,7 @@ namespace dgo
|
|||
return;
|
||||
}
|
||||
|
||||
void map_dialog_message_Trying::sm_unsupported_response(sip_dialog_messageContext& context)
|
||||
void map_dialog_message_Trying::sm_xxx_response(sip_dialog_messageContext& context)
|
||||
{
|
||||
|
||||
(context.getState()).Exit(context);
|
||||
|
@ -175,6 +181,50 @@ namespace dgo
|
|||
return;
|
||||
}
|
||||
|
||||
void map_dialog_message_Authentifying::Default(sip_dialog_messageContext& context)
|
||||
{
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_message_Authentifying::sm_1xx_response(sip_dialog_messageContext& context)
|
||||
{
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_message_Authentifying::sm_2xx_response(sip_dialog_messageContext& context)
|
||||
{
|
||||
|
||||
(context.getState()).Exit(context);
|
||||
context.setState(map_dialog_message::Terminated);
|
||||
(context.getState()).Entry(context);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_message_Authentifying::sm_authentificationSent(sip_dialog_messageContext& context)
|
||||
{
|
||||
|
||||
(context.getState()).Exit(context);
|
||||
context.setState(map_dialog_message::Trying);
|
||||
(context.getState()).Entry(context);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_message_Authentifying::sm_xxx_response(sip_dialog_messageContext& context)
|
||||
{
|
||||
|
||||
(context.getState()).Exit(context);
|
||||
context.setState(map_dialog_message::Terminated);
|
||||
(context.getState()).Entry(context);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_message_Terminated::Entry(sip_dialog_messageContext& context)
|
||||
|
||||
{
|
||||
|
|
|
@ -43,8 +43,9 @@ namespace dgo
|
|||
virtual void sm_1xx_response(sip_dialog_messageContext& context);
|
||||
virtual void sm_2xx_response(sip_dialog_messageContext& context);
|
||||
virtual void sm_401_407_421_494_response(sip_dialog_messageContext& context);
|
||||
virtual void sm_authentificationSent(sip_dialog_messageContext& context);
|
||||
virtual void sm_messageSent(sip_dialog_messageContext& context);
|
||||
virtual void sm_unsupported_response(sip_dialog_messageContext& context);
|
||||
virtual void sm_xxx_response(sip_dialog_messageContext& context);
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -98,7 +99,7 @@ namespace dgo
|
|||
void sm_1xx_response(sip_dialog_messageContext& context);
|
||||
void sm_2xx_response(sip_dialog_messageContext& context);
|
||||
void sm_401_407_421_494_response(sip_dialog_messageContext& context);
|
||||
void sm_unsupported_response(sip_dialog_messageContext& context);
|
||||
void sm_xxx_response(sip_dialog_messageContext& context);
|
||||
};
|
||||
|
||||
class map_dialog_message_Authentifying :
|
||||
|
@ -110,6 +111,11 @@ namespace dgo
|
|||
{};
|
||||
|
||||
void Entry(sip_dialog_messageContext&);
|
||||
void Default(sip_dialog_messageContext& context);
|
||||
void sm_1xx_response(sip_dialog_messageContext& context);
|
||||
void sm_2xx_response(sip_dialog_messageContext& context);
|
||||
void sm_authentificationSent(sip_dialog_messageContext& context);
|
||||
void sm_xxx_response(sip_dialog_messageContext& context);
|
||||
};
|
||||
|
||||
class map_dialog_message_Terminated :
|
||||
|
@ -175,14 +181,19 @@ namespace dgo
|
|||
(getState()).sm_401_407_421_494_response(*this);
|
||||
};
|
||||
|
||||
void sm_authentificationSent()
|
||||
{
|
||||
(getState()).sm_authentificationSent(*this);
|
||||
};
|
||||
|
||||
void sm_messageSent()
|
||||
{
|
||||
(getState()).sm_messageSent(*this);
|
||||
};
|
||||
|
||||
void sm_unsupported_response()
|
||||
void sm_xxx_response()
|
||||
{
|
||||
(getState()).sm_unsupported_response(*this);
|
||||
(getState()).sm_xxx_response(*this);
|
||||
};
|
||||
|
||||
private:
|
||||
|
|
|
@ -43,11 +43,445 @@ namespace dgo
|
|||
{
|
||||
// Static class declarations.
|
||||
map_dialog_publish_Initialized map_dialog_publish::Initialized("map_dialog_publish::Initialized", 0);
|
||||
map_dialog_publish_Trying map_dialog_publish::Trying("map_dialog_publish::Trying", 1);
|
||||
map_dialog_publish_Established map_dialog_publish::Established("map_dialog_publish::Established", 2);
|
||||
map_dialog_publish_Authentifying map_dialog_publish::Authentifying("map_dialog_publish::Authentifying", 3);
|
||||
map_dialog_publish_Terminated map_dialog_publish::Terminated("map_dialog_publish::Terminated", 4);
|
||||
|
||||
void sip_dialog_publishState::sm_1xx_response(sip_dialog_publishContext& context)
|
||||
{
|
||||
Default(context);
|
||||
return;
|
||||
}
|
||||
|
||||
void sip_dialog_publishState::sm_2xx_response(sip_dialog_publishContext& context, bool unpub)
|
||||
{
|
||||
Default(context);
|
||||
return;
|
||||
}
|
||||
|
||||
void sip_dialog_publishState::sm_3xx_response(sip_dialog_publishContext& context)
|
||||
{
|
||||
Default(context);
|
||||
return;
|
||||
}
|
||||
|
||||
void sip_dialog_publishState::sm_401_407_421_494_response(sip_dialog_publishContext& context)
|
||||
{
|
||||
Default(context);
|
||||
return;
|
||||
}
|
||||
|
||||
void sip_dialog_publishState::sm_4xx_response(sip_dialog_publishContext& context)
|
||||
{
|
||||
Default(context);
|
||||
return;
|
||||
}
|
||||
|
||||
void sip_dialog_publishState::sm_5xx_response(sip_dialog_publishContext& context)
|
||||
{
|
||||
Default(context);
|
||||
return;
|
||||
}
|
||||
|
||||
void sip_dialog_publishState::sm_6xx_response(sip_dialog_publishContext& context)
|
||||
{
|
||||
Default(context);
|
||||
return;
|
||||
}
|
||||
|
||||
void sip_dialog_publishState::sm_authentificationSent(sip_dialog_publishContext& context)
|
||||
{
|
||||
Default(context);
|
||||
return;
|
||||
}
|
||||
|
||||
void sip_dialog_publishState::sm_cancelSent(sip_dialog_publishContext& context)
|
||||
{
|
||||
Default(context);
|
||||
return;
|
||||
}
|
||||
|
||||
void sip_dialog_publishState::sm_publishSent(sip_dialog_publishContext& context)
|
||||
{
|
||||
Default(context);
|
||||
return;
|
||||
}
|
||||
|
||||
void sip_dialog_publishState::sm_unpublishSent(sip_dialog_publishContext& context)
|
||||
{
|
||||
Default(context);
|
||||
return;
|
||||
}
|
||||
|
||||
void sip_dialog_publishState::sm_xxx_response(sip_dialog_publishContext& context)
|
||||
{
|
||||
Default(context);
|
||||
return;
|
||||
}
|
||||
|
||||
void sip_dialog_publishState::Default(sip_dialog_publishContext& context)
|
||||
{
|
||||
assert(1==0);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Default::sm_401_407_421_494_response(sip_dialog_publishContext& context)
|
||||
{
|
||||
|
||||
(context.getState()).Exit(context);
|
||||
context.setState(map_dialog_publish::Authentifying);
|
||||
(context.getState()).Entry(context);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Default::sm_3xx_response(sip_dialog_publishContext& context)
|
||||
{
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Default::sm_4xx_response(sip_dialog_publishContext& context)
|
||||
{
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Default::sm_5xx_response(sip_dialog_publishContext& context)
|
||||
{
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Default::sm_6xx_response(sip_dialog_publishContext& context)
|
||||
{
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Default::sm_xxx_response(sip_dialog_publishContext& context)
|
||||
{
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Default::Default(sip_dialog_publishContext& context)
|
||||
{
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Initialized::Entry(sip_dialog_publishContext& context)
|
||||
|
||||
{
|
||||
sip_dialog_publish& ctxt(context.getOwner());
|
||||
|
||||
ctxt.OnStateChanged(SS_PUBLISH_INITIALIZED);
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Initialized::sm_publishSent(sip_dialog_publishContext& context)
|
||||
{
|
||||
|
||||
(context.getState()).Exit(context);
|
||||
context.setState(map_dialog_publish::Trying);
|
||||
(context.getState()).Entry(context);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Trying::Entry(sip_dialog_publishContext& context)
|
||||
|
||||
{
|
||||
sip_dialog_publish& ctxt(context.getOwner());
|
||||
|
||||
ctxt.OnStateChanged(SS_PUBLISH_TRYING);
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Trying::Default(sip_dialog_publishContext& context)
|
||||
{
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Trying::sm_1xx_response(sip_dialog_publishContext& context)
|
||||
{
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Trying::sm_2xx_response(sip_dialog_publishContext& context, bool unpub)
|
||||
{
|
||||
|
||||
if (unpub == true)
|
||||
{
|
||||
(context.getState()).Exit(context);
|
||||
// No actions.
|
||||
context.setState(map_dialog_publish::Terminated);
|
||||
(context.getState()).Entry(context);
|
||||
}
|
||||
else if (unpub == false)
|
||||
|
||||
{
|
||||
(context.getState()).Exit(context);
|
||||
// No actions.
|
||||
context.setState(map_dialog_publish::Established);
|
||||
(context.getState()).Entry(context);
|
||||
} else
|
||||
{
|
||||
map_dialog_publish_Default::sm_2xx_response(context, unpub);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Trying::sm_3xx_response(sip_dialog_publishContext& context)
|
||||
{
|
||||
|
||||
(context.getState()).Exit(context);
|
||||
context.setState(map_dialog_publish::Terminated);
|
||||
(context.getState()).Entry(context);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Trying::sm_401_407_421_494_response(sip_dialog_publishContext& context)
|
||||
{
|
||||
|
||||
(context.getState()).Exit(context);
|
||||
context.setState(map_dialog_publish::Authentifying);
|
||||
(context.getState()).Entry(context);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Trying::sm_4xx_response(sip_dialog_publishContext& context)
|
||||
{
|
||||
|
||||
(context.getState()).Exit(context);
|
||||
context.setState(map_dialog_publish::Terminated);
|
||||
(context.getState()).Entry(context);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Trying::sm_5xx_response(sip_dialog_publishContext& context)
|
||||
{
|
||||
|
||||
(context.getState()).Exit(context);
|
||||
context.setState(map_dialog_publish::Terminated);
|
||||
(context.getState()).Entry(context);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Trying::sm_6xx_response(sip_dialog_publishContext& context)
|
||||
{
|
||||
|
||||
(context.getState()).Exit(context);
|
||||
context.setState(map_dialog_publish::Terminated);
|
||||
(context.getState()).Entry(context);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Trying::sm_cancelSent(sip_dialog_publishContext& context)
|
||||
{
|
||||
|
||||
(context.getState()).Exit(context);
|
||||
context.setState(map_dialog_publish::Terminated);
|
||||
(context.getState()).Entry(context);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Trying::sm_xxx_response(sip_dialog_publishContext& context)
|
||||
{
|
||||
|
||||
(context.getState()).Exit(context);
|
||||
context.setState(map_dialog_publish::Terminated);
|
||||
(context.getState()).Entry(context);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Established::Entry(sip_dialog_publishContext& context)
|
||||
|
||||
{
|
||||
sip_dialog_publish& ctxt(context.getOwner());
|
||||
|
||||
ctxt.OnStateChanged(SS_PUBLISH_ESTABLISHED);
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Established::Default(sip_dialog_publishContext& context)
|
||||
{
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Established::sm_1xx_response(sip_dialog_publishContext& context)
|
||||
{
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Established::sm_2xx_response(sip_dialog_publishContext& context, bool unpub)
|
||||
{
|
||||
|
||||
if (unpub == true)
|
||||
{
|
||||
(context.getState()).Exit(context);
|
||||
// No actions.
|
||||
context.setState(map_dialog_publish::Terminated);
|
||||
(context.getState()).Entry(context);
|
||||
}
|
||||
else if (unpub == false)
|
||||
|
||||
{
|
||||
// No actions.
|
||||
} else
|
||||
{
|
||||
map_dialog_publish_Default::sm_2xx_response(context, unpub);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Established::sm_401_407_421_494_response(sip_dialog_publishContext& context)
|
||||
{
|
||||
|
||||
(context.getState()).Exit(context);
|
||||
context.setState(map_dialog_publish::Authentifying);
|
||||
(context.getState()).Entry(context);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Established::sm_publishSent(sip_dialog_publishContext& context)
|
||||
{
|
||||
|
||||
(context.getState()).Exit(context);
|
||||
context.setState(map_dialog_publish::Trying);
|
||||
(context.getState()).Entry(context);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Established::sm_unpublishSent(sip_dialog_publishContext& context)
|
||||
{
|
||||
|
||||
(context.getState()).Exit(context);
|
||||
context.setState(map_dialog_publish::Trying);
|
||||
(context.getState()).Entry(context);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Established::sm_xxx_response(sip_dialog_publishContext& context)
|
||||
{
|
||||
|
||||
(context.getState()).Exit(context);
|
||||
context.setState(map_dialog_publish::Terminated);
|
||||
(context.getState()).Entry(context);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Authentifying::Entry(sip_dialog_publishContext& context)
|
||||
|
||||
{
|
||||
sip_dialog_publish& ctxt(context.getOwner());
|
||||
|
||||
ctxt.OnStateChanged(SS_PUBLISH_AUTHENTIFYING);
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Authentifying::Default(sip_dialog_publishContext& context)
|
||||
{
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Authentifying::sm_1xx_response(sip_dialog_publishContext& context)
|
||||
{
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Authentifying::sm_2xx_response(sip_dialog_publishContext& context, bool unpub)
|
||||
{
|
||||
|
||||
if (unpub == true)
|
||||
{
|
||||
(context.getState()).Exit(context);
|
||||
// No actions.
|
||||
context.setState(map_dialog_publish::Terminated);
|
||||
(context.getState()).Entry(context);
|
||||
}
|
||||
else if (unpub == false)
|
||||
|
||||
{
|
||||
(context.getState()).Exit(context);
|
||||
// No actions.
|
||||
context.setState(map_dialog_publish::Established);
|
||||
(context.getState()).Entry(context);
|
||||
} else
|
||||
{
|
||||
map_dialog_publish_Default::sm_2xx_response(context, unpub);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Authentifying::sm_authentificationSent(sip_dialog_publishContext& context)
|
||||
{
|
||||
|
||||
(context.getState()).Exit(context);
|
||||
context.setState(map_dialog_publish::Trying);
|
||||
(context.getState()).Entry(context);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Authentifying::sm_xxx_response(sip_dialog_publishContext& context)
|
||||
{
|
||||
|
||||
(context.getState()).Exit(context);
|
||||
context.setState(map_dialog_publish::Terminated);
|
||||
(context.getState()).Entry(context);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Terminated::Entry(sip_dialog_publishContext& context)
|
||||
|
||||
{
|
||||
sip_dialog_publish& ctxt(context.getOwner());
|
||||
|
||||
ctxt.OnStateChanged(SS_PUBLISH_TERMINATED);
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_publish_Terminated::Default(sip_dialog_publishContext& context)
|
||||
{
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,10 @@ namespace dgo
|
|||
// Forward declarations.
|
||||
class map_dialog_publish;
|
||||
class map_dialog_publish_Initialized;
|
||||
class map_dialog_publish_Trying;
|
||||
class map_dialog_publish_Established;
|
||||
class map_dialog_publish_Authentifying;
|
||||
class map_dialog_publish_Terminated;
|
||||
class map_dialog_publish_Default;
|
||||
class sip_dialog_publishState;
|
||||
class sip_dialog_publishContext;
|
||||
|
@ -37,6 +41,18 @@ namespace dgo
|
|||
virtual void Entry(sip_dialog_publishContext&) {};
|
||||
virtual void Exit(sip_dialog_publishContext&) {};
|
||||
|
||||
virtual void sm_1xx_response(sip_dialog_publishContext& context);
|
||||
virtual void sm_2xx_response(sip_dialog_publishContext& context, bool unpub);
|
||||
virtual void sm_3xx_response(sip_dialog_publishContext& context);
|
||||
virtual void sm_401_407_421_494_response(sip_dialog_publishContext& context);
|
||||
virtual void sm_4xx_response(sip_dialog_publishContext& context);
|
||||
virtual void sm_5xx_response(sip_dialog_publishContext& context);
|
||||
virtual void sm_6xx_response(sip_dialog_publishContext& context);
|
||||
virtual void sm_authentificationSent(sip_dialog_publishContext& context);
|
||||
virtual void sm_cancelSent(sip_dialog_publishContext& context);
|
||||
virtual void sm_publishSent(sip_dialog_publishContext& context);
|
||||
virtual void sm_unpublishSent(sip_dialog_publishContext& context);
|
||||
virtual void sm_xxx_response(sip_dialog_publishContext& context);
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -48,6 +64,10 @@ namespace dgo
|
|||
public:
|
||||
|
||||
static map_dialog_publish_Initialized Initialized;
|
||||
static map_dialog_publish_Trying Trying;
|
||||
static map_dialog_publish_Established Established;
|
||||
static map_dialog_publish_Authentifying Authentifying;
|
||||
static map_dialog_publish_Terminated Terminated;
|
||||
};
|
||||
|
||||
class map_dialog_publish_Default :
|
||||
|
@ -59,6 +79,13 @@ namespace dgo
|
|||
: sip_dialog_publishState(name, stateId)
|
||||
{};
|
||||
|
||||
virtual void sm_401_407_421_494_response(sip_dialog_publishContext& context);
|
||||
virtual void sm_3xx_response(sip_dialog_publishContext& context);
|
||||
virtual void sm_4xx_response(sip_dialog_publishContext& context);
|
||||
virtual void sm_5xx_response(sip_dialog_publishContext& context);
|
||||
virtual void sm_6xx_response(sip_dialog_publishContext& context);
|
||||
virtual void sm_xxx_response(sip_dialog_publishContext& context);
|
||||
virtual void Default(sip_dialog_publishContext& context);
|
||||
};
|
||||
|
||||
class map_dialog_publish_Initialized :
|
||||
|
@ -69,6 +96,75 @@ namespace dgo
|
|||
: map_dialog_publish_Default(name, stateId)
|
||||
{};
|
||||
|
||||
void Entry(sip_dialog_publishContext&);
|
||||
void sm_publishSent(sip_dialog_publishContext& context);
|
||||
};
|
||||
|
||||
class map_dialog_publish_Trying :
|
||||
public map_dialog_publish_Default
|
||||
{
|
||||
public:
|
||||
map_dialog_publish_Trying(const char *name, int stateId)
|
||||
: map_dialog_publish_Default(name, stateId)
|
||||
{};
|
||||
|
||||
void Entry(sip_dialog_publishContext&);
|
||||
void Default(sip_dialog_publishContext& context);
|
||||
void sm_1xx_response(sip_dialog_publishContext& context);
|
||||
void sm_2xx_response(sip_dialog_publishContext& context, bool unpub);
|
||||
void sm_3xx_response(sip_dialog_publishContext& context);
|
||||
void sm_401_407_421_494_response(sip_dialog_publishContext& context);
|
||||
void sm_4xx_response(sip_dialog_publishContext& context);
|
||||
void sm_5xx_response(sip_dialog_publishContext& context);
|
||||
void sm_6xx_response(sip_dialog_publishContext& context);
|
||||
void sm_cancelSent(sip_dialog_publishContext& context);
|
||||
void sm_xxx_response(sip_dialog_publishContext& context);
|
||||
};
|
||||
|
||||
class map_dialog_publish_Established :
|
||||
public map_dialog_publish_Default
|
||||
{
|
||||
public:
|
||||
map_dialog_publish_Established(const char *name, int stateId)
|
||||
: map_dialog_publish_Default(name, stateId)
|
||||
{};
|
||||
|
||||
void Entry(sip_dialog_publishContext&);
|
||||
void Default(sip_dialog_publishContext& context);
|
||||
void sm_1xx_response(sip_dialog_publishContext& context);
|
||||
void sm_2xx_response(sip_dialog_publishContext& context, bool unpub);
|
||||
void sm_401_407_421_494_response(sip_dialog_publishContext& context);
|
||||
void sm_publishSent(sip_dialog_publishContext& context);
|
||||
void sm_unpublishSent(sip_dialog_publishContext& context);
|
||||
void sm_xxx_response(sip_dialog_publishContext& context);
|
||||
};
|
||||
|
||||
class map_dialog_publish_Authentifying :
|
||||
public map_dialog_publish_Default
|
||||
{
|
||||
public:
|
||||
map_dialog_publish_Authentifying(const char *name, int stateId)
|
||||
: map_dialog_publish_Default(name, stateId)
|
||||
{};
|
||||
|
||||
void Entry(sip_dialog_publishContext&);
|
||||
void Default(sip_dialog_publishContext& context);
|
||||
void sm_1xx_response(sip_dialog_publishContext& context);
|
||||
void sm_2xx_response(sip_dialog_publishContext& context, bool unpub);
|
||||
void sm_authentificationSent(sip_dialog_publishContext& context);
|
||||
void sm_xxx_response(sip_dialog_publishContext& context);
|
||||
};
|
||||
|
||||
class map_dialog_publish_Terminated :
|
||||
public map_dialog_publish_Default
|
||||
{
|
||||
public:
|
||||
map_dialog_publish_Terminated(const char *name, int stateId)
|
||||
: map_dialog_publish_Default(name, stateId)
|
||||
{};
|
||||
|
||||
void Entry(sip_dialog_publishContext&);
|
||||
void Default(sip_dialog_publishContext& context);
|
||||
};
|
||||
|
||||
class sip_dialog_publishContext :
|
||||
|
@ -107,6 +203,66 @@ namespace dgo
|
|||
return (dynamic_cast<sip_dialog_publishState&>(*_state));
|
||||
};
|
||||
|
||||
void sm_1xx_response()
|
||||
{
|
||||
(getState()).sm_1xx_response(*this);
|
||||
};
|
||||
|
||||
void sm_2xx_response(bool unpub)
|
||||
{
|
||||
(getState()).sm_2xx_response(*this, unpub);
|
||||
};
|
||||
|
||||
void sm_3xx_response()
|
||||
{
|
||||
(getState()).sm_3xx_response(*this);
|
||||
};
|
||||
|
||||
void sm_401_407_421_494_response()
|
||||
{
|
||||
(getState()).sm_401_407_421_494_response(*this);
|
||||
};
|
||||
|
||||
void sm_4xx_response()
|
||||
{
|
||||
(getState()).sm_4xx_response(*this);
|
||||
};
|
||||
|
||||
void sm_5xx_response()
|
||||
{
|
||||
(getState()).sm_5xx_response(*this);
|
||||
};
|
||||
|
||||
void sm_6xx_response()
|
||||
{
|
||||
(getState()).sm_6xx_response(*this);
|
||||
};
|
||||
|
||||
void sm_authentificationSent()
|
||||
{
|
||||
(getState()).sm_authentificationSent(*this);
|
||||
};
|
||||
|
||||
void sm_cancelSent()
|
||||
{
|
||||
(getState()).sm_cancelSent(*this);
|
||||
};
|
||||
|
||||
void sm_publishSent()
|
||||
{
|
||||
(getState()).sm_publishSent(*this);
|
||||
};
|
||||
|
||||
void sm_unpublishSent()
|
||||
{
|
||||
(getState()).sm_unpublishSent(*this);
|
||||
};
|
||||
|
||||
void sm_xxx_response()
|
||||
{
|
||||
(getState()).sm_xxx_response(*this);
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
sip_dialog_publish& _owner;
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace dgo
|
|||
return;
|
||||
}
|
||||
|
||||
void sip_dialog_registerState::sm_2xx_response(sip_dialog_registerContext& context)
|
||||
void sip_dialog_registerState::sm_2xx_response(sip_dialog_registerContext& context, bool unreg)
|
||||
{
|
||||
Default(context);
|
||||
return;
|
||||
|
@ -96,6 +96,12 @@ namespace dgo
|
|||
return;
|
||||
}
|
||||
|
||||
void sip_dialog_registerState::sm_cancelSent(sip_dialog_registerContext& context)
|
||||
{
|
||||
Default(context);
|
||||
return;
|
||||
}
|
||||
|
||||
void sip_dialog_registerState::sm_registerSent(sip_dialog_registerContext& context)
|
||||
{
|
||||
Default(context);
|
||||
|
@ -121,6 +127,58 @@ namespace dgo
|
|||
return;
|
||||
}
|
||||
|
||||
void map_dialog_register_Default::sm_401_407_421_494_response(sip_dialog_registerContext& context)
|
||||
{
|
||||
|
||||
(context.getState()).Exit(context);
|
||||
context.setState(map_dialog_register::Authentifying);
|
||||
(context.getState()).Entry(context);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_register_Default::sm_3xx_response(sip_dialog_registerContext& context)
|
||||
{
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_register_Default::sm_4xx_response(sip_dialog_registerContext& context)
|
||||
{
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_register_Default::sm_5xx_response(sip_dialog_registerContext& context)
|
||||
{
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_register_Default::sm_6xx_response(sip_dialog_registerContext& context)
|
||||
{
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_register_Default::sm_xxx_response(sip_dialog_registerContext& context)
|
||||
{
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_register_Default::Default(sip_dialog_registerContext& context)
|
||||
{
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_register_Initialized::Entry(sip_dialog_registerContext& context)
|
||||
|
||||
{
|
||||
|
@ -132,19 +190,9 @@ namespace dgo
|
|||
|
||||
void map_dialog_register_Initialized::sm_registerSent(sip_dialog_registerContext& context)
|
||||
{
|
||||
sip_dialog_register& ctxt(context.getOwner());
|
||||
|
||||
(context.getState()).Exit(context);
|
||||
context.clearState();
|
||||
try
|
||||
{
|
||||
ctxt.set_registering(true);
|
||||
context.setState(map_dialog_register::Trying);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
context.setState(map_dialog_register::Trying);
|
||||
}
|
||||
context.setState(map_dialog_register::Trying);
|
||||
(context.getState()).Entry(context);
|
||||
|
||||
return;
|
||||
|
@ -162,9 +210,6 @@ namespace dgo
|
|||
void map_dialog_register_Trying::Default(sip_dialog_registerContext& context)
|
||||
{
|
||||
|
||||
(context.getState()).Exit(context);
|
||||
context.setState(map_dialog_register::Terminated);
|
||||
(context.getState()).Entry(context);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -176,27 +221,26 @@ namespace dgo
|
|||
return;
|
||||
}
|
||||
|
||||
void map_dialog_register_Trying::sm_2xx_response(sip_dialog_registerContext& context)
|
||||
void map_dialog_register_Trying::sm_2xx_response(sip_dialog_registerContext& context, bool unreg)
|
||||
{
|
||||
sip_dialog_register& ctxt(context.getOwner());
|
||||
|
||||
if (ctxt.get_registering() == true)
|
||||
if (unreg == true)
|
||||
{
|
||||
(context.getState()).Exit(context);
|
||||
// No actions.
|
||||
context.setState(map_dialog_register::Established);
|
||||
(context.getState()).Entry(context);
|
||||
}
|
||||
else if (ctxt.get_registering() == false)
|
||||
|
||||
{
|
||||
(context.getState()).Exit(context);
|
||||
// No actions.
|
||||
context.setState(map_dialog_register::Terminated);
|
||||
(context.getState()).Entry(context);
|
||||
}
|
||||
else if (unreg == false)
|
||||
|
||||
{
|
||||
(context.getState()).Exit(context);
|
||||
// No actions.
|
||||
context.setState(map_dialog_register::Established);
|
||||
(context.getState()).Entry(context);
|
||||
} else
|
||||
{
|
||||
map_dialog_register_Default::sm_2xx_response(context);
|
||||
map_dialog_register_Default::sm_2xx_response(context, unreg);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -252,6 +296,16 @@ namespace dgo
|
|||
return;
|
||||
}
|
||||
|
||||
void map_dialog_register_Trying::sm_cancelSent(sip_dialog_registerContext& context)
|
||||
{
|
||||
|
||||
(context.getState()).Exit(context);
|
||||
context.setState(map_dialog_register::Terminated);
|
||||
(context.getState()).Entry(context);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_register_Trying::sm_xxx_response(sip_dialog_registerContext& context)
|
||||
{
|
||||
|
||||
|
@ -274,9 +328,6 @@ namespace dgo
|
|||
void map_dialog_register_Established::Default(sip_dialog_registerContext& context)
|
||||
{
|
||||
|
||||
(context.getState()).Exit(context);
|
||||
context.setState(map_dialog_register::Terminated);
|
||||
(context.getState()).Entry(context);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -288,28 +339,53 @@ namespace dgo
|
|||
return;
|
||||
}
|
||||
|
||||
void map_dialog_register_Established::sm_2xx_response(sip_dialog_registerContext& context)
|
||||
void map_dialog_register_Established::sm_2xx_response(sip_dialog_registerContext& context, bool unreg)
|
||||
{
|
||||
|
||||
if (unreg == true)
|
||||
{
|
||||
(context.getState()).Exit(context);
|
||||
// No actions.
|
||||
context.setState(map_dialog_register::Terminated);
|
||||
(context.getState()).Entry(context);
|
||||
}
|
||||
else if (unreg == false)
|
||||
|
||||
{
|
||||
// No actions.
|
||||
} else
|
||||
{
|
||||
map_dialog_register_Default::sm_2xx_response(context, unreg);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_register_Established::sm_401_407_421_494_response(sip_dialog_registerContext& context)
|
||||
{
|
||||
|
||||
(context.getState()).Exit(context);
|
||||
context.setState(map_dialog_register::Authentifying);
|
||||
(context.getState()).Entry(context);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_register_Established::sm_unregisterSent(sip_dialog_registerContext& context)
|
||||
{
|
||||
sip_dialog_register& ctxt(context.getOwner());
|
||||
|
||||
(context.getState()).Exit(context);
|
||||
context.clearState();
|
||||
try
|
||||
{
|
||||
ctxt.set_registering(false);
|
||||
context.setState(map_dialog_register::Trying);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
context.setState(map_dialog_register::Trying);
|
||||
}
|
||||
context.setState(map_dialog_register::Trying);
|
||||
(context.getState()).Entry(context);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_register_Established::sm_xxx_response(sip_dialog_registerContext& context)
|
||||
{
|
||||
|
||||
(context.getState()).Exit(context);
|
||||
context.setState(map_dialog_register::Terminated);
|
||||
(context.getState()).Entry(context);
|
||||
|
||||
return;
|
||||
|
@ -327,9 +403,6 @@ namespace dgo
|
|||
void map_dialog_register_Authentifying::Default(sip_dialog_registerContext& context)
|
||||
{
|
||||
|
||||
(context.getState()).Exit(context);
|
||||
context.setState(map_dialog_register::Terminated);
|
||||
(context.getState()).Entry(context);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -341,20 +414,26 @@ namespace dgo
|
|||
return;
|
||||
}
|
||||
|
||||
void map_dialog_register_Authentifying::sm_2xx_response(sip_dialog_registerContext& context)
|
||||
void map_dialog_register_Authentifying::sm_2xx_response(sip_dialog_registerContext& context, bool unreg)
|
||||
{
|
||||
sip_dialog_register& ctxt(context.getOwner());
|
||||
|
||||
if (ctxt.get_registering() == true)
|
||||
if (unreg == true)
|
||||
{
|
||||
(context.getState()).Exit(context);
|
||||
// No actions.
|
||||
context.setState(map_dialog_register::Terminated);
|
||||
(context.getState()).Entry(context);
|
||||
}
|
||||
else if (unreg == false)
|
||||
|
||||
{
|
||||
(context.getState()).Exit(context);
|
||||
// No actions.
|
||||
context.setState(map_dialog_register::Established);
|
||||
(context.getState()).Entry(context);
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
map_dialog_register_Default::sm_2xx_response(context);
|
||||
map_dialog_register_Default::sm_2xx_response(context, unreg);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -370,6 +449,16 @@ namespace dgo
|
|||
return;
|
||||
}
|
||||
|
||||
void map_dialog_register_Authentifying::sm_xxx_response(sip_dialog_registerContext& context)
|
||||
{
|
||||
|
||||
(context.getState()).Exit(context);
|
||||
context.setState(map_dialog_register::Terminated);
|
||||
(context.getState()).Entry(context);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_register_Terminated::Entry(sip_dialog_registerContext& context)
|
||||
|
||||
{
|
||||
|
|
|
@ -42,13 +42,14 @@ namespace dgo
|
|||
virtual void Exit(sip_dialog_registerContext&) {};
|
||||
|
||||
virtual void sm_1xx_response(sip_dialog_registerContext& context);
|
||||
virtual void sm_2xx_response(sip_dialog_registerContext& context);
|
||||
virtual void sm_2xx_response(sip_dialog_registerContext& context, bool unreg);
|
||||
virtual void sm_3xx_response(sip_dialog_registerContext& context);
|
||||
virtual void sm_401_407_421_494_response(sip_dialog_registerContext& context);
|
||||
virtual void sm_4xx_response(sip_dialog_registerContext& context);
|
||||
virtual void sm_5xx_response(sip_dialog_registerContext& context);
|
||||
virtual void sm_6xx_response(sip_dialog_registerContext& context);
|
||||
virtual void sm_authentificationSent(sip_dialog_registerContext& context);
|
||||
virtual void sm_cancelSent(sip_dialog_registerContext& context);
|
||||
virtual void sm_registerSent(sip_dialog_registerContext& context);
|
||||
virtual void sm_unregisterSent(sip_dialog_registerContext& context);
|
||||
virtual void sm_xxx_response(sip_dialog_registerContext& context);
|
||||
|
@ -78,6 +79,13 @@ namespace dgo
|
|||
: sip_dialog_registerState(name, stateId)
|
||||
{};
|
||||
|
||||
virtual void sm_401_407_421_494_response(sip_dialog_registerContext& context);
|
||||
virtual void sm_3xx_response(sip_dialog_registerContext& context);
|
||||
virtual void sm_4xx_response(sip_dialog_registerContext& context);
|
||||
virtual void sm_5xx_response(sip_dialog_registerContext& context);
|
||||
virtual void sm_6xx_response(sip_dialog_registerContext& context);
|
||||
virtual void sm_xxx_response(sip_dialog_registerContext& context);
|
||||
virtual void Default(sip_dialog_registerContext& context);
|
||||
};
|
||||
|
||||
class map_dialog_register_Initialized :
|
||||
|
@ -103,12 +111,13 @@ namespace dgo
|
|||
void Entry(sip_dialog_registerContext&);
|
||||
void Default(sip_dialog_registerContext& context);
|
||||
void sm_1xx_response(sip_dialog_registerContext& context);
|
||||
void sm_2xx_response(sip_dialog_registerContext& context);
|
||||
void sm_2xx_response(sip_dialog_registerContext& context, bool unreg);
|
||||
void sm_3xx_response(sip_dialog_registerContext& context);
|
||||
void sm_401_407_421_494_response(sip_dialog_registerContext& context);
|
||||
void sm_4xx_response(sip_dialog_registerContext& context);
|
||||
void sm_5xx_response(sip_dialog_registerContext& context);
|
||||
void sm_6xx_response(sip_dialog_registerContext& context);
|
||||
void sm_cancelSent(sip_dialog_registerContext& context);
|
||||
void sm_xxx_response(sip_dialog_registerContext& context);
|
||||
};
|
||||
|
||||
|
@ -123,8 +132,10 @@ namespace dgo
|
|||
void Entry(sip_dialog_registerContext&);
|
||||
void Default(sip_dialog_registerContext& context);
|
||||
void sm_1xx_response(sip_dialog_registerContext& context);
|
||||
void sm_2xx_response(sip_dialog_registerContext& context);
|
||||
void sm_2xx_response(sip_dialog_registerContext& context, bool unreg);
|
||||
void sm_401_407_421_494_response(sip_dialog_registerContext& context);
|
||||
void sm_unregisterSent(sip_dialog_registerContext& context);
|
||||
void sm_xxx_response(sip_dialog_registerContext& context);
|
||||
};
|
||||
|
||||
class map_dialog_register_Authentifying :
|
||||
|
@ -138,8 +149,9 @@ namespace dgo
|
|||
void Entry(sip_dialog_registerContext&);
|
||||
void Default(sip_dialog_registerContext& context);
|
||||
void sm_1xx_response(sip_dialog_registerContext& context);
|
||||
void sm_2xx_response(sip_dialog_registerContext& context);
|
||||
void sm_2xx_response(sip_dialog_registerContext& context, bool unreg);
|
||||
void sm_authentificationSent(sip_dialog_registerContext& context);
|
||||
void sm_xxx_response(sip_dialog_registerContext& context);
|
||||
};
|
||||
|
||||
class map_dialog_register_Terminated :
|
||||
|
@ -195,9 +207,9 @@ namespace dgo
|
|||
(getState()).sm_1xx_response(*this);
|
||||
};
|
||||
|
||||
void sm_2xx_response()
|
||||
void sm_2xx_response(bool unreg)
|
||||
{
|
||||
(getState()).sm_2xx_response(*this);
|
||||
(getState()).sm_2xx_response(*this, unreg);
|
||||
};
|
||||
|
||||
void sm_3xx_response()
|
||||
|
@ -230,6 +242,11 @@ namespace dgo
|
|||
(getState()).sm_authentificationSent(*this);
|
||||
};
|
||||
|
||||
void sm_cancelSent()
|
||||
{
|
||||
(getState()).sm_cancelSent(*this);
|
||||
};
|
||||
|
||||
void sm_registerSent()
|
||||
{
|
||||
(getState()).sm_registerSent(*this);
|
||||
|
|
|
@ -3,12 +3,12 @@ set SMC_HOME=%ROOT_DIR%\SMC_6_0_0
|
|||
set SM_DIR=%ROOT_DIR%\doubango\sm
|
||||
set SRC_DIR=%ROOT_DIR%\doubango\src
|
||||
|
||||
rem java -jar %SMC_HOME%\Smc.jar -c++ -suffix cxx -verbose -noex -d %SRC_DIR% %SM_DIR%\sm_dialog_info.sm
|
||||
rem java -jar %SMC_HOME%\Smc.jar -c++ -suffix cxx -verbose -noex -d %SRC_DIR% %SM_DIR%\sm_dialog_invite.sm
|
||||
rem java -jar %SMC_HOME%\Smc.jar -c++ -suffix cxx -verbose -noex -d %SRC_DIR% %SM_DIR%\sm_dialog_message.sm
|
||||
rem java -jar %SMC_HOME%\Smc.jar -c++ -suffix cxx -verbose -noex -d %SRC_DIR% %SM_DIR%\sm_dialog_options.sm
|
||||
rem java -jar %SMC_HOME%\Smc.jar -c++ -suffix cxx -verbose -noex -d %SRC_DIR% %SM_DIR%\sm_dialog_publish.sm
|
||||
java -jar %SMC_HOME%\Smc.jar -c++ -suffix cxx -verbose -noex -d %SRC_DIR% %SM_DIR%\sm_dialog_info.sm
|
||||
java -jar %SMC_HOME%\Smc.jar -c++ -suffix cxx -verbose -noex -d %SRC_DIR% %SM_DIR%\sm_dialog_invite.sm
|
||||
java -jar %SMC_HOME%\Smc.jar -c++ -suffix cxx -verbose -noex -d %SRC_DIR% %SM_DIR%\sm_dialog_message.sm
|
||||
java -jar %SMC_HOME%\Smc.jar -c++ -suffix cxx -verbose -noex -d %SRC_DIR% %SM_DIR%\sm_dialog_options.sm
|
||||
java -jar %SMC_HOME%\Smc.jar -c++ -suffix cxx -verbose -noex -d %SRC_DIR% %SM_DIR%\sm_dialog_publish.sm
|
||||
java -jar %SMC_HOME%\Smc.jar -c++ -suffix cxx -verbose -noex -d %SRC_DIR% %SM_DIR%\sm_dialog_register.sm
|
||||
rem java -jar %SMC_HOME%\Smc.jar -c++ -suffix cxx -verbose -noex -d %SRC_DIR% %SM_DIR%\sm_dialog_subscribe.sm
|
||||
java -jar %SMC_HOME%\Smc.jar -c++ -suffix cxx -verbose -noex -d %SRC_DIR% %SM_DIR%\sm_dialog_subscribe.sm
|
||||
|
||||
pause
|
|
@ -26,7 +26,8 @@ int _tmain(int argc, _TCHAR* argv[])
|
|||
assert( ERR_SUCCEED(dgo::network_set_pcscf(STACK_ID, "192.168.0.14", 5060)) );
|
||||
|
||||
assert( ERR_SUCCEED(dgo::sip_register(STACK_ID)) );
|
||||
Sleep(1000);
|
||||
Sleep(5000);
|
||||
assert( ERR_SUCCEED(dgo::sip_publish(STACK_ID)) );
|
||||
//assert( ERR_SUCCEED(dgo::sip_message(STACK_ID, "sip:toto@wonderland.net", "text/plain", "test")) );
|
||||
Sleep(50000);
|
||||
assert( ERR_SUCCEED(dgo::sip_unregister(STACK_ID)) );
|
||||
|
|
Loading…
Reference in New Issue