]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Moved some initialisation code when making an FS outgoing call so initialisation...
authorRobert Joly <rjoly@nortel.com>
Wed, 18 Feb 2009 01:04:28 +0000 (01:04 +0000)
committerRobert Joly <rjoly@nortel.com>
Wed, 18 Feb 2009 01:04:28 +0000 (01:04 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12129 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_opal/mod_opal.cpp
src/mod/endpoints/mod_opal/mod_opal.h

index 4526942535b3de239aad6c6451cd75d03158c593..7dc5394ed1ae87b8d3feb96259760a05f205433d 100644 (file)
@@ -138,7 +138,7 @@ static switch_call_cause_t create_outgoing_channel(switch_core_session_t *sessio
     PString token;\r
 \r
     FSManager & manager = opal_process->GetManager();\r
-    if (!manager.SetUpCall("local:", outbound_profile->destination_number, token)) {\r
+    if (!manager.SetUpCall("local:", outbound_profile->destination_number, token, outbound_profile)) {\r
         return SWITCH_CAUSE_INVALID_NUMBER_FORMAT;\r
     }\r
 \r
@@ -156,19 +156,6 @@ static switch_call_cause_t create_outgoing_channel(switch_core_session_t *sessio
 \r
     *new_session = connection->GetSession();\r
 \r
-    connection->SetLocalPartyName(outbound_profile->caller_id_number);\r
-    connection->SetDisplayName(outbound_profile->caller_id_name);\r
-\r
-\r
-    switch_caller_profile_t *caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);\r
-    switch_channel_t *channel = switch_core_session_get_channel(*new_session);\r
-    char name[256] = "opal/";\r
-    switch_copy_string(name + 5, outbound_profile->destination_number, sizeof(name)-5);\r
-    switch_channel_set_name(channel, name);\r
-    switch_channel_set_flag(channel, CF_OUTBOUND);\r
-    switch_channel_set_caller_profile(channel, caller_profile);\r
-    switch_channel_set_state(channel, CS_INIT);\r
-\r
     return SWITCH_CAUSE_SUCCESS;\r
 }\r
 \r
@@ -483,14 +470,14 @@ bool FSEndPoint::OnIncomingCall(OpalLocalConnection & connection)
 \r
 OpalLocalConnection *FSEndPoint::CreateConnection(OpalCall & call, void *userData)\r
 {\r
-    return new FSConnection(call, *this);\r
+    return new FSConnection(call, *this, (switch_caller_profile_t *)userData);\r
 }\r
 \r
 \r
 ///////////////////////////////////////////////////////////////////////\r
 \r
 \r
-FSConnection::FSConnection(OpalCall & call, FSEndPoint & endpoint)\r
+FSConnection::FSConnection(OpalCall & call, FSEndPoint & endpoint, switch_caller_profile_t *outbound_profile)\r
   : OpalLocalConnection(call, endpoint, NULL)\r
   , m_endpoint(endpoint)\r
 {\r
@@ -502,6 +489,21 @@ FSConnection::FSConnection(OpalCall & call, FSEndPoint & endpoint)
     tech_pvt = (opal_private_t *) switch_core_session_alloc(m_fsSession, sizeof(*tech_pvt));\r
     tech_pvt->me = this;\r
     switch_core_session_set_private(m_fsSession, tech_pvt);\r
+\r
+    if (outbound_profile != NULL) {\r
+        SetLocalPartyName(outbound_profile->caller_id_number);\r
+        SetDisplayName(outbound_profile->caller_id_name);\r
+\r
+        switch_caller_profile_t *caller_profile = switch_caller_profile_clone(m_fsSession, outbound_profile);\r
+        switch_channel_set_caller_profile(m_fsChannel, caller_profile);\r
+\r
+        PString name = "opal/";\r
+        name += outbound_profile->destination_number;\r
+        switch_channel_set_name(m_fsChannel, name);\r
+\r
+        switch_channel_set_flag(m_fsChannel, CF_OUTBOUND);\r
+        switch_channel_set_state(m_fsChannel, CS_INIT);\r
+    }\r
 }\r
 \r
 \r
index 24d7367d820196934e72badf3e5075bfa883b079..badf2d6a5edf4b93226f5e6c65ee7deb0e5cfa50 100644 (file)
 #ifndef __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 <opal/manager.h>
 #include <opal/localep.h>
 #include <h323/h323ep.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 FSManager;
@@ -154,7 +154,7 @@ class FSConnection:public OpalLocalConnection {
     PCLASSINFO(FSConnection, OpalLocalConnection)
 
   public:
-    FSConnection(OpalCall & call, FSEndPoint & endpoint);
+    FSConnection(OpalCall & call, FSEndPoint & endpoint, switch_caller_profile_t *outbound_profile);
 
     virtual bool OnIncoming();
     virtual void OnReleased();