Update REGISTER dialog to allow 401/407 auth challenge.
Update sip_dialog_register state machine
This commit is contained in:
parent
33789b9235
commit
c31b6e927f
|
@ -45,20 +45,32 @@ Initialized Entry { OnStateChanged(SS_REGISTER_INITIALIZED); }
|
|||
|
||||
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_1xx_response() nil {}
|
||||
sm_2xx_response() [ctxt.get_registering() == true] Established {}
|
||||
sm_2xx_response() [ctxt.get_registering() == false] Terminated {}
|
||||
sm_3xx_response() Terminated {}
|
||||
sm_401_407_421_494_response() Authentifying {}
|
||||
sm_unsupported_response() Terminated {}
|
||||
sm_4xx_response() Terminated {}
|
||||
sm_5xx_response() Terminated {}
|
||||
sm_6xx_response() Terminated {}
|
||||
sm_xxx_response() Terminated {}
|
||||
Default Terminated {}
|
||||
}
|
||||
|
||||
Established Entry { OnStateChanged(SS_REGISTER_ESTABLISHED); }
|
||||
{
|
||||
sm_unregisterSent() Trying { set_registering(false); }
|
||||
sm_1xx_response() nil {}
|
||||
sm_2xx_response() nil {}
|
||||
sm_unregisterSent() Trying { set_registering(false); }
|
||||
Default Terminated {}
|
||||
}
|
||||
|
||||
Authentifying Entry { OnStateChanged(SS_REGISTER_AUTHENTIFYING); }
|
||||
{
|
||||
sm_1xx_response() nil {}
|
||||
sm_2xx_response() [ctxt.get_registering() == true] Established {}
|
||||
sm_authentificationSent() Trying {}
|
||||
Default Terminated {}
|
||||
}
|
||||
|
||||
Terminated Entry { OnStateChanged(SS_REGISTER_TERMINATED); }
|
||||
|
@ -66,10 +78,15 @@ Terminated Entry { OnStateChanged(SS_REGISTER_TERMINATED); }
|
|||
Default nil {}
|
||||
}
|
||||
|
||||
Default Entry { OnStateChanged(SS_REGISTER_UNKNOWN); }
|
||||
{
|
||||
sm_401_407_421_494_response() Authentifying {}
|
||||
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 {}
|
||||
//}
|
||||
|
||||
%%
|
|
@ -134,24 +134,31 @@ ERR auth_set_security_mechanism(int stack_id, const char* security_mechanism)
|
|||
return ERR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ERR auth_set_early_ims(int stack_id, bool early_ims)
|
||||
{
|
||||
GET_STACK(stack_id, stk);
|
||||
stk->set_early_ims( early_ims );
|
||||
return ERR_SUCCESS;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// network
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
ERR network_set(int stack_id, const char* pcscf_ip, int pcscf_port, const char* transport)
|
||||
ERR network_set(int stack_id, const char* pcscf, int pcscf_port, const char* transport)
|
||||
{
|
||||
return ERR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ERR network_set_pcscf(int stack_id, const char* pcscf_ip, int pcscf_port)
|
||||
ERR network_set_pcscf(int stack_id, const char* pcscf, int pcscf_port)
|
||||
{
|
||||
GET_STACK(stack_id, stk);
|
||||
char* pcscf = su_sprintf(stk->get_home(), "sip:%s:%d", pcscf_ip, pcscf_port);
|
||||
char* pcscf_ip_port = su_sprintf(NULL, "sip:%s:%d", pcscf, pcscf_port);
|
||||
nua_set_params(stk->get_nua(),
|
||||
NUTAG_PROXY(pcscf),
|
||||
NUTAG_PROXY(pcscf_ip_port),
|
||||
NUTAG_OUTBOUND("no-validate"),
|
||||
TAG_NULL());
|
||||
su_free(stk->get_home(), pcscf);
|
||||
|
||||
su_free(NULL, pcscf_ip_port);
|
||||
|
||||
return ERR_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -31,12 +31,13 @@ DOUBANGO_API_C ERR auth_set_operator_id(int stack_id, const char* operator_id);
|
|||
DOUBANGO_API_C ERR auth_set_amf(int stack_id, const char* amf);
|
||||
DOUBANGO_API_C ERR auth_set_privacy(int stack_id, const char* privacy);
|
||||
DOUBANGO_API_C ERR auth_set_security_mechanism(int stack_id, const char* security_mechanism);
|
||||
DOUBANGO_API_C ERR auth_set_early_ims(int stack_id, bool early_ims);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// network
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
DOUBANGO_API_C ERR network_set(int stack_id, const char* pcscf_ip, int pcscf_port, const char* transport);
|
||||
DOUBANGO_API_C ERR network_set_pcscf(int stack_id, const char* pcscf_ip, int pcscf_port);
|
||||
DOUBANGO_API_C ERR network_set(int stack_id, const char* pcscf, int pcscf_port, const char* transport);
|
||||
DOUBANGO_API_C ERR network_set_pcscf(int stack_id, const char* pcscf, int pcscf_port);
|
||||
DOUBANGO_API_C ERR network_set_transport(int stack_id, const char* transport);
|
||||
DOUBANGO_API_C ERR network_set_net_info(int stack_id, const char* net_info);
|
||||
|
||||
|
|
|
@ -21,7 +21,10 @@ stack::stack(int _id, nua_callback_f _callback)
|
|||
|
||||
/* authentication */
|
||||
displayname = NULL, public_id = NULL, private_id = NULL, realm = NULL,
|
||||
password = NULL, privacy = NULL, pcscf_ip = NULL, pcscf_port = 5060;
|
||||
password = NULL, privacy = NULL, early_ims = false;
|
||||
|
||||
/* Network */
|
||||
pcscf = NULL, pcscf_port = 5060;
|
||||
|
||||
/* Features */
|
||||
smsip = true, oma_large_msg = true, oma_sip_im = true, gsma_is = true, gsma_vs = true;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include <list>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
PREF_NAMESPACE_START
|
||||
|
||||
/* generate setter and getter methods*/
|
||||
|
@ -80,7 +80,12 @@ public:
|
|||
DEFINE_GET_SET(char*, realm);
|
||||
DEFINE_GET_SET(char*, password);
|
||||
DEFINE_GET_SET(char*, privacy);
|
||||
DEFINE_GET_SET(char*, pcscf_ip);
|
||||
DEFINE_GET_SET(bool, early_ims);
|
||||
|
||||
//
|
||||
// Network
|
||||
//
|
||||
DEFINE_GET_SET(char*, pcscf);
|
||||
DEFINE_GET_SET(int, pcscf_port);
|
||||
|
||||
//
|
||||
|
@ -127,7 +132,12 @@ private:
|
|||
char* realm;
|
||||
char* password;
|
||||
char* privacy;
|
||||
char* pcscf_ip;
|
||||
bool early_ims;
|
||||
|
||||
//
|
||||
// Network
|
||||
//
|
||||
char* pcscf;
|
||||
int pcscf_port;
|
||||
|
||||
//
|
||||
|
|
|
@ -25,6 +25,11 @@
|
|||
*
|
||||
*/
|
||||
#include "sip_dialog.h"
|
||||
#include "api_stack.h"
|
||||
|
||||
#include <nua_stack.h>
|
||||
#include <sofia-sip/sip_hclasses.h>
|
||||
#include <sofia-sip/msg_header.h>
|
||||
|
||||
PREF_NAMESPACE_START
|
||||
|
||||
|
@ -47,4 +52,19 @@ void sip_dialog::OnStateChanged(SIP_STATE state)
|
|||
SU_DEBUG_3(("%s::OnStateChanged ==> %d\n", this->get_sipmethod(), 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* scheme = sip->sip_www_authenticate?
|
||||
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());
|
||||
|
||||
nua_authenticate(nh, NUTAG_AUTH(authstring), TAG_END());
|
||||
|
||||
su_free(NULL, authstring);
|
||||
}
|
||||
|
||||
PREF_NAMESPACE_END
|
|
@ -34,7 +34,6 @@
|
|||
|
||||
#include <sofia-sip/nua_tag.h>
|
||||
#include <sofia-sip/nua.h>
|
||||
#include <sofia-sip/su_debug.h>
|
||||
|
||||
PREF_NAMESPACE_START
|
||||
|
||||
|
@ -65,6 +64,9 @@ public:
|
|||
tagi_t tags[]) = 0;
|
||||
|
||||
|
||||
protected:
|
||||
void authenticate(nua_handle_t *nh, sip_t const *sip);
|
||||
|
||||
protected:
|
||||
nua_handle_t* handle;
|
||||
stack* stk;
|
||||
|
|
|
@ -50,8 +50,7 @@ sip_dialog_message::~sip_dialog_message()
|
|||
/* start sending MESSAGE */
|
||||
ERR sip_dialog_message::Start()
|
||||
{
|
||||
this->handle = nua_handle(this->stk->get_nua(), this->stk->get_home(),
|
||||
SIPTAG_TO_STR(this->dest_address), TAG_END());
|
||||
this->handle = nua_handle(this->stk->get_nua(), this->stk->get_home(), TAG_END());
|
||||
|
||||
if(!this->handle)
|
||||
{
|
||||
|
@ -59,6 +58,8 @@ ERR sip_dialog_message::Start()
|
|||
}
|
||||
|
||||
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());
|
||||
|
|
|
@ -55,40 +55,14 @@ ERR sip_dialog_register::Start()
|
|||
return ERR_GLOBAL_FAILURE;
|
||||
}
|
||||
|
||||
nua_register(this->handle,
|
||||
SIPTAG_PRIVACY_STR(this->stk->get_privacy()),
|
||||
NUTAG_OUTBOUND("no-options-keepalive"),
|
||||
NUTAG_OUTBOUND("no-validate"),
|
||||
NUTAG_KEEPALIVE(0),
|
||||
SIPTAG_EXPIRES_STR("20"),
|
||||
//NUTAG_M_USERNAME("doubango"),
|
||||
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"),
|
||||
|
||||
|
||||
//NUTAG_M_FEATURES("+g.3gpp.smsip;+g.3gpp.cs-voice"),
|
||||
//TAG_IF(this->gsma_vs, NUTAG_M_FEATURES("+g.3gpp.cs-voice")),
|
||||
|
||||
TAG_END());
|
||||
this->sm_ctx.sm_registerSent();
|
||||
|
||||
return ERR_SUCCESS;
|
||||
return this->sendRegister();
|
||||
}
|
||||
|
||||
/* stop */
|
||||
ERR sip_dialog_register::Stop()
|
||||
{
|
||||
if(this->handle)
|
||||
{
|
||||
nua_unregister(this->handle, TAG_END());
|
||||
this->sm_ctx.sm_unregisterSent();
|
||||
|
||||
return ERR_SUCCESS;
|
||||
}
|
||||
else return ERR_SIP_DIALOG_UNKNOWN;
|
||||
ERR err = this->sendUnregister();
|
||||
return err;
|
||||
}
|
||||
|
||||
/* state changed */
|
||||
|
@ -109,6 +83,55 @@ inline bool sip_dialog_register::get_terminated()const
|
|||
return (this->state_current == SS_REGISTER_TERMINATED);
|
||||
}
|
||||
|
||||
/* send SIP REGISTER request */
|
||||
ERR sip_dialog_register::sendRegister()
|
||||
{
|
||||
if(!this->handle) return ERR_SIP_DIALOG_UNKNOWN;
|
||||
|
||||
// FIXME: secure
|
||||
bool secure = false;
|
||||
char* ims_default_auth = su_sprintf(NULL, "Digest username=\"%s\",realm=\"%s\",nonce=\"\",uri=\"%s:%s\",response=\"\"",
|
||||
this->stk->get_private_id(), this->stk->get_realm(), secure?"sips":"sip",this->stk->get_realm());
|
||||
|
||||
nua_register(this->handle,
|
||||
SIPTAG_PRIVACY_STR(this->stk->get_privacy()),
|
||||
NUTAG_OUTBOUND("no-options-keepalive"),
|
||||
NUTAG_OUTBOUND("no-validate"),
|
||||
NUTAG_KEEPALIVE(0),
|
||||
SIPTAG_EXPIRES_STR("20"),
|
||||
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"),
|
||||
SIPTAG_ALLOW_EVENTS_STR("presence"),
|
||||
TAG_IF(!this->stk->get_early_ims(), SIPTAG_AUTHORIZATION_STR(ims_default_auth)), /* 3GPP TS 24.229. See section 5.1.1 */
|
||||
|
||||
//NUTAG_M_FEATURES("+g.3gpp.smsip;+g.3gpp.cs-voice"),
|
||||
//TAG_IF(this->gsma_vs, NUTAG_M_FEATURES("+g.3gpp.cs-voice")),
|
||||
|
||||
TAG_END());
|
||||
this->sm_ctx.sm_registerSent();
|
||||
|
||||
su_free(NULL, ims_default_auth);
|
||||
return ERR_SUCCESS;
|
||||
}
|
||||
|
||||
/* send SIP UNREGISTER request*/
|
||||
ERR sip_dialog_register::sendUnregister()
|
||||
{
|
||||
if(this->handle)
|
||||
{
|
||||
nua_unregister(this->handle, TAG_END());
|
||||
this->sm_ctx.sm_unregisterSent();
|
||||
|
||||
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,
|
||||
|
@ -124,9 +147,17 @@ void sip_dialog_register::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 <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;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,10 @@ public:
|
|||
bool get_registering() { return this->registering; }
|
||||
void set_registering(bool val) { this->registering = val; }
|
||||
|
||||
private:
|
||||
ERR sendRegister();
|
||||
ERR sendUnregister();
|
||||
|
||||
private:
|
||||
sip_dialog_registerContext sm_ctx;
|
||||
bool registering;
|
||||
|
|
|
@ -60,12 +60,42 @@ namespace dgo
|
|||
return;
|
||||
}
|
||||
|
||||
void sip_dialog_registerState::sm_3xx_response(sip_dialog_registerContext& context)
|
||||
{
|
||||
Default(context);
|
||||
return;
|
||||
}
|
||||
|
||||
void sip_dialog_registerState::sm_401_407_421_494_response(sip_dialog_registerContext& context)
|
||||
{
|
||||
Default(context);
|
||||
return;
|
||||
}
|
||||
|
||||
void sip_dialog_registerState::sm_4xx_response(sip_dialog_registerContext& context)
|
||||
{
|
||||
Default(context);
|
||||
return;
|
||||
}
|
||||
|
||||
void sip_dialog_registerState::sm_5xx_response(sip_dialog_registerContext& context)
|
||||
{
|
||||
Default(context);
|
||||
return;
|
||||
}
|
||||
|
||||
void sip_dialog_registerState::sm_6xx_response(sip_dialog_registerContext& context)
|
||||
{
|
||||
Default(context);
|
||||
return;
|
||||
}
|
||||
|
||||
void sip_dialog_registerState::sm_authentificationSent(sip_dialog_registerContext& context)
|
||||
{
|
||||
Default(context);
|
||||
return;
|
||||
}
|
||||
|
||||
void sip_dialog_registerState::sm_registerSent(sip_dialog_registerContext& context)
|
||||
{
|
||||
Default(context);
|
||||
|
@ -78,7 +108,7 @@ namespace dgo
|
|||
return;
|
||||
}
|
||||
|
||||
void sip_dialog_registerState::sm_unsupported_response(sip_dialog_registerContext& context)
|
||||
void sip_dialog_registerState::sm_xxx_response(sip_dialog_registerContext& context)
|
||||
{
|
||||
Default(context);
|
||||
return;
|
||||
|
@ -91,23 +121,6 @@ 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::Default(sip_dialog_registerContext& context)
|
||||
{
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_register_Initialized::Entry(sip_dialog_registerContext& context)
|
||||
|
||||
{
|
||||
|
@ -146,6 +159,16 @@ namespace dgo
|
|||
return;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
void map_dialog_register_Trying::sm_1xx_response(sip_dialog_registerContext& context)
|
||||
{
|
||||
|
||||
|
@ -179,6 +202,16 @@ namespace dgo
|
|||
return;
|
||||
}
|
||||
|
||||
void map_dialog_register_Trying::sm_3xx_response(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_401_407_421_494_response(sip_dialog_registerContext& context)
|
||||
{
|
||||
|
||||
|
@ -189,7 +222,37 @@ namespace dgo
|
|||
return;
|
||||
}
|
||||
|
||||
void map_dialog_register_Trying::sm_unsupported_response(sip_dialog_registerContext& context)
|
||||
void map_dialog_register_Trying::sm_4xx_response(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_5xx_response(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_6xx_response(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)
|
||||
{
|
||||
|
||||
(context.getState()).Exit(context);
|
||||
|
@ -208,6 +271,30 @@ namespace dgo
|
|||
return;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
void map_dialog_register_Established::sm_1xx_response(sip_dialog_registerContext& context)
|
||||
{
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_register_Established::sm_2xx_response(sip_dialog_registerContext& context)
|
||||
{
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_register_Established::sm_unregisterSent(sip_dialog_registerContext& context)
|
||||
{
|
||||
sip_dialog_register& ctxt(context.getOwner());
|
||||
|
@ -237,6 +324,52 @@ namespace dgo
|
|||
return;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
void map_dialog_register_Authentifying::sm_1xx_response(sip_dialog_registerContext& context)
|
||||
{
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_register_Authentifying::sm_2xx_response(sip_dialog_registerContext& context)
|
||||
{
|
||||
sip_dialog_register& ctxt(context.getOwner());
|
||||
|
||||
if (ctxt.get_registering() == true)
|
||||
{
|
||||
(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);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_register_Authentifying::sm_authentificationSent(sip_dialog_registerContext& context)
|
||||
{
|
||||
|
||||
(context.getState()).Exit(context);
|
||||
context.setState(map_dialog_register::Trying);
|
||||
(context.getState()).Entry(context);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void map_dialog_register_Terminated::Entry(sip_dialog_registerContext& context)
|
||||
|
||||
{
|
||||
|
|
|
@ -43,10 +43,15 @@ namespace dgo
|
|||
|
||||
virtual void sm_1xx_response(sip_dialog_registerContext& context);
|
||||
virtual void sm_2xx_response(sip_dialog_registerContext& context);
|
||||
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_registerSent(sip_dialog_registerContext& context);
|
||||
virtual void sm_unregisterSent(sip_dialog_registerContext& context);
|
||||
virtual void sm_unsupported_response(sip_dialog_registerContext& context);
|
||||
virtual void sm_xxx_response(sip_dialog_registerContext& context);
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -73,8 +78,6 @@ namespace dgo
|
|||
: sip_dialog_registerState(name, stateId)
|
||||
{};
|
||||
|
||||
virtual void sm_401_407_421_494_response(sip_dialog_registerContext& context);
|
||||
virtual void Default(sip_dialog_registerContext& context);
|
||||
};
|
||||
|
||||
class map_dialog_register_Initialized :
|
||||
|
@ -98,10 +101,15 @@ 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_3xx_response(sip_dialog_registerContext& context);
|
||||
void sm_401_407_421_494_response(sip_dialog_registerContext& context);
|
||||
void sm_unsupported_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_xxx_response(sip_dialog_registerContext& context);
|
||||
};
|
||||
|
||||
class map_dialog_register_Established :
|
||||
|
@ -113,6 +121,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_unregisterSent(sip_dialog_registerContext& context);
|
||||
};
|
||||
|
||||
|
@ -125,6 +136,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_authentificationSent(sip_dialog_registerContext& context);
|
||||
};
|
||||
|
||||
class map_dialog_register_Terminated :
|
||||
|
@ -185,11 +200,36 @@ namespace dgo
|
|||
(getState()).sm_2xx_response(*this);
|
||||
};
|
||||
|
||||
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_registerSent()
|
||||
{
|
||||
(getState()).sm_registerSent(*this);
|
||||
|
@ -200,9 +240,9 @@ namespace dgo
|
|||
(getState()).sm_unregisterSent(*this);
|
||||
};
|
||||
|
||||
void sm_unsupported_response()
|
||||
void sm_xxx_response()
|
||||
{
|
||||
(getState()).sm_unsupported_response(*this);
|
||||
(getState()).sm_xxx_response(*this);
|
||||
};
|
||||
|
||||
private:
|
||||
|
|
|
@ -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
|
||||
|
||||
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
|
||||
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_register.sm
|
||||
java -jar %SMC_HOME%\Smc.jar -c++ -suffix cxx -verbose -noex -d %SRC_DIR% %SM_DIR%\sm_dialog_subscribe.sm
|
||||
rem java -jar %SMC_HOME%\Smc.jar -c++ -suffix cxx -verbose -noex -d %SRC_DIR% %SM_DIR%\sm_dialog_subscribe.sm
|
||||
|
||||
pause
|
|
@ -19,14 +19,15 @@ int _tmain(int argc, _TCHAR* argv[])
|
|||
|
||||
//Sleep(1000);
|
||||
|
||||
assert( ERR_SUCCEED(dgo::auth_set(STACK_ID, "sip:doubango@wonderland.net", "doubango", "doubango", "wonderland.net" )) );
|
||||
assert( ERR_SUCCEED(dgo::auth_set_early_ims(STACK_ID, false)) );
|
||||
assert( ERR_SUCCEED(dgo::auth_set(STACK_ID, "sip:doubango@wonderland.net", "doubango@wonderland.net", "doubango", "wonderland.net" )) );
|
||||
assert( ERR_SUCCEED(dgo::auth_set_privacy(STACK_ID, "none")) );
|
||||
assert( ERR_SUCCEED(dgo::auth_set_displayname(STACK_ID, "My display Name")) );
|
||||
assert( ERR_SUCCEED(dgo::network_set_pcscf(STACK_ID, "192.168.0.14", 5060)) );
|
||||
|
||||
assert( ERR_SUCCEED(dgo::sip_register(STACK_ID)) );
|
||||
Sleep(1000);
|
||||
assert( ERR_SUCCEED(dgo::sip_message(STACK_ID, "sip:toto@wonderland.net", "text/plain", "test")) );
|
||||
//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)) );
|
||||
Sleep(5000);
|
||||
|
@ -34,6 +35,7 @@ int _tmain(int argc, _TCHAR* argv[])
|
|||
assert( ERR_SUCCEED(dgo::engine_deinitialize()) );
|
||||
|
||||
Sleep(5000);
|
||||
//http://sofia-sip.sourceforge.net/refdocs/iptsec/index.html
|
||||
// FIXME:http://209.85.229.132/search?q=cache:8_OFeYfRS9EJ:fisheye.freeswitch.org/browse/~raw,r%3D14993/FreeSWITCH/src/mod/endpoints/mod_sofia/sofia_reg.c+nua_unregister&cd=7&hl=en&ct=clnk
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue