提交 da14c819 authored 作者: Robert Joly's avatar Robert Joly

Moved some initialisation code when making an FS outgoing call so initialisation…

Moved some initialisation code when making an FS outgoing call so initialisation of some internal OpalConnection fields are done early enough.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12129 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 a4f115ee
...@@ -138,7 +138,7 @@ static switch_call_cause_t create_outgoing_channel(switch_core_session_t *sessio ...@@ -138,7 +138,7 @@ static switch_call_cause_t create_outgoing_channel(switch_core_session_t *sessio
PString token; PString token;
FSManager & manager = opal_process->GetManager(); FSManager & manager = opal_process->GetManager();
if (!manager.SetUpCall("local:", outbound_profile->destination_number, token)) { if (!manager.SetUpCall("local:", outbound_profile->destination_number, token, outbound_profile)) {
return SWITCH_CAUSE_INVALID_NUMBER_FORMAT; return SWITCH_CAUSE_INVALID_NUMBER_FORMAT;
} }
...@@ -156,19 +156,6 @@ static switch_call_cause_t create_outgoing_channel(switch_core_session_t *sessio ...@@ -156,19 +156,6 @@ static switch_call_cause_t create_outgoing_channel(switch_core_session_t *sessio
*new_session = connection->GetSession(); *new_session = connection->GetSession();
connection->SetLocalPartyName(outbound_profile->caller_id_number);
connection->SetDisplayName(outbound_profile->caller_id_name);
switch_caller_profile_t *caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);
switch_channel_t *channel = switch_core_session_get_channel(*new_session);
char name[256] = "opal/";
switch_copy_string(name + 5, outbound_profile->destination_number, sizeof(name)-5);
switch_channel_set_name(channel, name);
switch_channel_set_flag(channel, CF_OUTBOUND);
switch_channel_set_caller_profile(channel, caller_profile);
switch_channel_set_state(channel, CS_INIT);
return SWITCH_CAUSE_SUCCESS; return SWITCH_CAUSE_SUCCESS;
} }
...@@ -483,14 +470,14 @@ bool FSEndPoint::OnIncomingCall(OpalLocalConnection & connection) ...@@ -483,14 +470,14 @@ bool FSEndPoint::OnIncomingCall(OpalLocalConnection & connection)
OpalLocalConnection *FSEndPoint::CreateConnection(OpalCall & call, void *userData) OpalLocalConnection *FSEndPoint::CreateConnection(OpalCall & call, void *userData)
{ {
return new FSConnection(call, *this); return new FSConnection(call, *this, (switch_caller_profile_t *)userData);
} }
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
FSConnection::FSConnection(OpalCall & call, FSEndPoint & endpoint) FSConnection::FSConnection(OpalCall & call, FSEndPoint & endpoint, switch_caller_profile_t *outbound_profile)
: OpalLocalConnection(call, endpoint, NULL) : OpalLocalConnection(call, endpoint, NULL)
, m_endpoint(endpoint) , m_endpoint(endpoint)
{ {
...@@ -502,6 +489,21 @@ FSConnection::FSConnection(OpalCall & call, FSEndPoint & endpoint) ...@@ -502,6 +489,21 @@ FSConnection::FSConnection(OpalCall & call, FSEndPoint & endpoint)
tech_pvt = (opal_private_t *) switch_core_session_alloc(m_fsSession, sizeof(*tech_pvt)); tech_pvt = (opal_private_t *) switch_core_session_alloc(m_fsSession, sizeof(*tech_pvt));
tech_pvt->me = this; tech_pvt->me = this;
switch_core_session_set_private(m_fsSession, tech_pvt); switch_core_session_set_private(m_fsSession, tech_pvt);
if (outbound_profile != NULL) {
SetLocalPartyName(outbound_profile->caller_id_number);
SetDisplayName(outbound_profile->caller_id_name);
switch_caller_profile_t *caller_profile = switch_caller_profile_clone(m_fsSession, outbound_profile);
switch_channel_set_caller_profile(m_fsChannel, caller_profile);
PString name = "opal/";
name += outbound_profile->destination_number;
switch_channel_set_name(m_fsChannel, name);
switch_channel_set_flag(m_fsChannel, CF_OUTBOUND);
switch_channel_set_state(m_fsChannel, CS_INIT);
}
} }
......
...@@ -26,20 +26,20 @@ ...@@ -26,20 +26,20 @@
#ifndef __FREESWITCH_MOD_OPAL__ #ifndef __FREESWITCH_MOD_OPAL__
#define __FREESWITCH_MOD_OPAL__ #define __FREESWITCH_MOD_OPAL__
#define HAVE_APR
#include <switch.h>
#include <switch_version.h>
#define MODNAME "mod_opal"
#undef strcasecmp
#undef strncasecmp
#include <ptlib.h> #include <ptlib.h>
#include <opal/manager.h> #include <opal/manager.h>
#include <opal/localep.h> #include <opal/localep.h>
#include <h323/h323ep.h> #include <h323/h323ep.h>
#include <iax2/iax2ep.h> #include <iax2/iax2ep.h>
#undef strcasecmp
#undef strncasecmp
#define HAVE_APR
#include <switch.h>
#include <switch_version.h>
#define MODNAME "mod_opal"
class FSEndPoint; class FSEndPoint;
class FSManager; class FSManager;
...@@ -154,7 +154,7 @@ class FSConnection:public OpalLocalConnection { ...@@ -154,7 +154,7 @@ class FSConnection:public OpalLocalConnection {
PCLASSINFO(FSConnection, OpalLocalConnection) PCLASSINFO(FSConnection, OpalLocalConnection)
public: public:
FSConnection(OpalCall & call, FSEndPoint & endpoint); FSConnection(OpalCall & call, FSEndPoint & endpoint, switch_caller_profile_t *outbound_profile);
virtual bool OnIncoming(); virtual bool OnIncoming();
virtual void OnReleased(); virtual void OnReleased();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论