Commit 78ad76dd authored by jehan's avatar jehan

add new gstate REG_PENDING, OUT_RINGING

concatenate Reason header with reason phrase in case of state error
parent f159efb8
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
......@@ -7,6 +7,8 @@
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.2079208171" moduleId="org.eclipse.cdt.core.settings" name="Default">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.MachO64" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
......@@ -18,7 +20,7 @@
<configuration artifactName="linphone" buildProperties="" description="" id="0.2079208171" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg">
<folderInfo id="0.2079208171." name="/" resourcePath="">
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.2084203071" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.2084203071.81924294" name=""/>
<targetPlatform binaryParser="org.eclipse.cdt.core.MachO64;org.eclipse.cdt.core.ELF" id="org.eclipse.cdt.build.core.prefbase.toolchain.2084203071.81924294" name=""/>
<builder id="org.eclipse.cdt.build.core.settings.default.builder.731584538" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.1252970003" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.1371414073" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
......@@ -201,6 +203,27 @@
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
<buildTargets>
<target name="all" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildTarget>all</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="install" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>install</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
</buildTargets>
</storageModule>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
......
......@@ -124,6 +124,7 @@ static void call_ringing(SalOp *h){
if (lc->sound_conf.play_sndcard!=NULL){
ms_message("Remote ringing...");
lc->ringstream=ring_start(lc->sound_conf.remote_ring,2000,lc->sound_conf.play_sndcard);
gstate_new_state(lc, GSTATE_CALL_OUT_RINGING, NULL);
}
}else{
/*accept early media */
......@@ -137,7 +138,7 @@ static void call_ringing(SalOp *h){
if (lc->vtable.show) lc->vtable.show(lc);
if (lc->vtable.display_status)
lc->vtable.display_status(lc,_("Early media."));
gstate_new_state(lc, GSTATE_CALL_OUT_CONNECTED, NULL);
gstate_new_state(lc, GSTATE_CALL_OUT_RINGING, NULL);
if (lc->ringstream!=NULL){
ring_stop(lc->ringstream);
lc->ringstream=NULL;
......@@ -270,7 +271,7 @@ static void call_failure(SalOp *op, SalError error, SalReason sr, const char *de
/*char *retrymsg=_("%s. Retry after %i minute(s).");*/
char *msg600=_("User does not want to be disturbed.");
char *msg603=_("Call declined.");
char *msg=NULL;
char *msg=(char*)details;
LinphoneCall *call=lc->call;
if (sal_op_get_user_pointer(op)!=lc->call){
......
......@@ -345,6 +345,7 @@ typedef enum _gstate {
GSTATE_REG_NONE = 10, /* initial state */
GSTATE_REG_OK,
GSTATE_REG_FAILED,
GSTATE_REG_PENDING, /* a registration request is ongoing*/
/* states for GSTATE_GROUP_CALL */
GSTATE_CALL_IDLE = 20, /* initial state */
GSTATE_CALL_OUT_INVITE,
......@@ -353,7 +354,8 @@ typedef enum _gstate {
GSTATE_CALL_IN_CONNECTED,
GSTATE_CALL_END,
GSTATE_CALL_ERROR,
GSTATE_INVALID
GSTATE_INVALID,
GSTATE_CALL_OUT_RINGING /*remote ringing*/
} gstate_t;
struct _LinphoneGeneralState {
......
......@@ -239,7 +239,11 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *obj){
sal_op_release(obj->op);
obj->op=sal_op_new(obj->lc->sal);
sal_op_set_user_pointer(obj->op,obj);
sal_register(obj->op,obj->reg_proxy,obj->reg_identity,obj->expires);
if (!sal_register(obj->op,obj->reg_proxy,obj->reg_identity,obj->expires)) {
gstate_new_state(obj->lc,GSTATE_REG_PENDING,NULL);
} else {
gstate_new_state(obj->lc,GSTATE_REG_FAILED,NULL);
}
}
}
......
......@@ -994,10 +994,12 @@ static void authentication_ok(Sal *sal, eXosip_event_t *ev){
static bool_t call_failure(Sal *sal, eXosip_event_t *ev){
SalOp *op;
int code=0;
char* computedReason=NULL;
const char *reason=NULL;
SalError error=SalErrorUnknown;
SalReason sr=SalReasonUnknown;
op=(SalOp*)find_op(sal,ev);
if (op==NULL) {
......@@ -1008,6 +1010,15 @@ static bool_t call_failure(Sal *sal, eXosip_event_t *ev){
if (ev->response){
code=osip_message_get_status_code(ev->response);
reason=osip_message_get_reason_phrase(ev->response);
osip_header_t *h=NULL;
if (!osip_message_header_get_byname( ev->response
,"Reason"
,0
,&h)) {
computedReason = ms_strdup_printf("%s %s",reason,osip_header_get_value(h));
reason = computedReason;
}
}
switch(code)
{
......@@ -1054,6 +1065,9 @@ static bool_t call_failure(Sal *sal, eXosip_event_t *ev){
}else error=SalErrorNoResponse;
}
sal->callbacks.call_failure(op,error,sr,reason);
if (computedReason != NULL){
ms_free(computedReason);
}
return TRUE;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment