<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[Freeswitch-trunk][17476] </title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<div id="header">FreeSWITCH Subversion</div>
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://fisheye.freeswitch.org/changelog/FreeSWITCH?cs=17476">17476</a></dd>
<dt>Author</dt> <dd>anthm</dd>
<dt>Date</dt> <dd>2010-05-03 12:35:48 -0500 (Mon, 03 May 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre><a href="http://jira.freeswitch.org/browse/FSCORE-601">FSCORE-601</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunksrcswitch_ivr_originatec">freeswitch/trunk/src/switch_ivr_originate.c</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunksrcswitch_ivr_originatec"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/switch_ivr_originate.c (17475 => 17476)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/switch_ivr_originate.c        2010-05-03 17:35:48 UTC (rev 17475)
+++ freeswitch/trunk/src/switch_ivr_originate.c        2010-05-03 17:35:48 UTC (rev 17476)
</span><span class="lines">@@ -121,6 +121,8 @@
</span><span class="cx">         int sending_ringback;
</span><span class="cx">         int bridge_early_media;
</span><span class="cx">         switch_thread_t *ethread;
</span><ins>+        switch_caller_profile_t *caller_profile_override;
+        switch_memory_pool_t *pool;
</ins><span class="cx"> } originate_global_t;
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -1449,8 +1451,11 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if (session) {
</span><ins>+                switch_caller_profile_t *cpp = NULL;
</ins><span class="cx">                 channel = switch_core_session_get_channel(session);
</span><del>-                cp = switch_channel_get_caller_profile(channel);
</del><ins>+                if ((cpp = switch_channel_get_caller_profile(channel))) {
+                        cp = switch_caller_profile_dup(pool, cpp);
+                }
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         switch_threadattr_create(&amp;thd_attr, pool);
</span><span class="lines">@@ -1724,7 +1729,6 @@
</span><span class="cx">         ringback_t ringback = { 0 };
</span><span class="cx">         time_t start;
</span><span class="cx">         switch_frame_t *read_frame = NULL;
</span><del>-        switch_memory_pool_t *pool = NULL;
</del><span class="cx">         int r = 0, i, and_argc = 0, or_argc = 0;
</span><span class="cx">         int32_t sleep_ms = 1000, try = 0, retries = 1;
</span><span class="cx">         switch_codec_t write_codec = { 0 };
</span><span class="lines">@@ -1760,7 +1764,18 @@
</span><span class="cx"> 
</span><span class="cx">         oglobals.ringback_ok = 1;
</span><span class="cx">         oglobals.bridge_early_media = -1;
</span><ins>+        switch_core_new_memory_pool(&amp;oglobals.pool);
</ins><span class="cx"> 
</span><ins>+        if (caller_profile_override) {
+                oglobals.caller_profile_override = switch_caller_profile_dup(oglobals.pool, caller_profile_override);
+        } else if (session) {
+                switch_caller_profile_t *cp = switch_channel_get_caller_profile(switch_core_session_get_channel(session));
+
+                if (cp) {
+                        oglobals.caller_profile_override = switch_caller_profile_dup(oglobals.pool, cp);
+                }
+        }
+
</ins><span class="cx">         if (session) {
</span><span class="cx">                 const char *to_var, *bypass_media = NULL, *proxy_media = NULL;
</span><span class="cx">                 caller_channel = switch_core_session_get_channel(session);
</span><span class="lines">@@ -2235,7 +2250,6 @@
</span><span class="cx">                         peer_channel = NULL;
</span><span class="cx">                         start = 0;
</span><span class="cx">                         read_frame = NULL;
</span><del>-                        pool = NULL;
</del><span class="cx">                         oglobals.ringback_ok = 1;
</span><span class="cx">                         var = NULL;
</span><span class="cx">                         to = 0;
</span><span class="lines">@@ -2313,9 +2327,16 @@
</span><span class="cx">                                                 status = SWITCH_STATUS_FALSE;
</span><span class="cx">                                                 goto done;
</span><span class="cx">                                         }
</span><ins>+                                        
+                                        if ((caller_caller_profile = oglobals.caller_profile_override)) {
+                                                new_profile = switch_caller_profile_dup(oglobals.pool, caller_caller_profile);
+                                        } else {
+                                                new_profile = switch_caller_profile_new(oglobals.pool,
+                                                                                                                                NULL,
+                                                                                                                                NULL,
+                                                                                                                                cid_name_override, cid_num_override, NULL, NULL, NULL, NULL, __FILE__, NULL, chan_data);
+                                        }
</ins><span class="cx"> 
</span><del>-                                        caller_caller_profile = caller_profile_override ? caller_profile_override : switch_channel_get_caller_profile(caller_channel);
-                                        new_profile = switch_caller_profile_clone(oglobals.session, caller_caller_profile);
</del><span class="cx">                                         new_profile-&gt;uuid = SWITCH_BLANK_STRING;
</span><span class="cx">                                         new_profile-&gt;chan_name = SWITCH_BLANK_STRING;
</span><span class="cx">                                         new_profile-&gt;destination_number = switch_core_strdup(new_profile-&gt;pool, chan_data);
</span><span class="lines">@@ -2344,13 +2365,9 @@
</span><span class="cx">                                         if (cid_num_override) {
</span><span class="cx">                                                 new_profile-&gt;caller_id_number = switch_core_strdup(new_profile-&gt;pool, cid_num_override);
</span><span class="cx">                                         }
</span><del>-
-                                        pool = NULL;
</del><span class="cx">                                 } else {
</span><del>-                                        switch_core_new_memory_pool(&amp;pool);
-
-                                        if (caller_profile_override) {
-                                                new_profile = switch_caller_profile_dup(pool, caller_profile_override);
</del><ins>+                                        if (oglobals.caller_profile_override) {
+                                                new_profile = switch_caller_profile_dup(oglobals.pool, caller_profile_override);
</ins><span class="cx">                                                 new_profile-&gt;destination_number = switch_core_strdup(new_profile-&gt;pool, switch_str_nil(chan_data));
</span><span class="cx">                                                 new_profile-&gt;uuid = SWITCH_BLANK_STRING;
</span><span class="cx">                                                 new_profile-&gt;chan_name = SWITCH_BLANK_STRING;
</span><span class="lines">@@ -2362,7 +2379,7 @@
</span><span class="cx">                                                         cid_num_override = &quot;0000000000&quot;;
</span><span class="cx">                                                 }
</span><span class="cx"> 
</span><del>-                                                new_profile = switch_caller_profile_new(pool,
</del><ins>+                                                new_profile = switch_caller_profile_new(oglobals.pool,
</ins><span class="cx">                                                                                                                                 NULL,
</span><span class="cx">                                                                                                                                 NULL,
</span><span class="cx">                                                                                                                                 cid_name_override, cid_num_override, NULL, NULL, NULL, NULL, __FILE__, NULL, chan_data);
</span><span class="lines">@@ -2471,18 +2488,14 @@
</span><span class="cx">                                                 switch_set_flag(new_profile, SWITCH_CPF_HIDE_NUMBER);
</span><span class="cx">                                         }
</span><span class="cx">                                 }
</span><del>-
</del><ins>+                                
</ins><span class="cx">                                 current_variable = NULL;
</span><span class="cx">                                 switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, &quot;originate_early_media&quot;, oglobals.early_ok ? &quot;true&quot; : &quot;false&quot;);
</span><span class="cx"> 
</span><span class="cx">                                 if ((reason = switch_core_session_outgoing_channel(oglobals.session, var_event, chan_type,
</span><del>-                                                                                                                                   new_profile, &amp;new_session, &amp;pool, myflags, cancel_cause)) != SWITCH_CAUSE_SUCCESS) {
</del><ins>+                                                                                                                                   new_profile, &amp;new_session, NULL, myflags, cancel_cause)) != SWITCH_CAUSE_SUCCESS) {
</ins><span class="cx">                                         switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, &quot;Cannot create outgoing channel of type [%s] cause: [%s]\n&quot;,
</span><span class="cx">                                                                           chan_type, switch_channel_cause2str(reason));
</span><del>-
-                                        if (pool) {
-                                                switch_core_destroy_memory_pool(&amp;pool);
-                                        }
</del><span class="cx">                                         continue;
</span><span class="cx">                                 }
</span><span class="cx"> 
</span><span class="lines">@@ -2490,11 +2503,11 @@
</span><span class="cx">                                         status = SWITCH_STATUS_FALSE;
</span><span class="cx">                                         goto done;
</span><span class="cx">                                 }
</span><del>-                                pool = NULL;
</del><span class="cx"> 
</span><del>-                                originate_status[i].caller_profile = new_profile;
</del><ins>+                                originate_status[i].peer_channel = switch_core_session_get_channel(new_session);
+                                originate_status[i].caller_profile = switch_channel_get_caller_profile(originate_status[i].peer_channel);
</ins><span class="cx">                                 originate_status[i].peer_session = new_session;
</span><del>-                                originate_status[i].peer_channel = switch_core_session_get_channel(new_session);
</del><ins>+
</ins><span class="cx">                                 switch_channel_set_flag(originate_status[i].peer_channel, CF_ORIGINATING);
</span><span class="cx"> 
</span><span class="cx">                                 if ((lc = switch_event_get_header(var_event, &quot;local_var_clobber&quot;))) {
</span><span class="lines">@@ -3434,6 +3447,8 @@
</span><span class="cx">                 *cause = force_reason;
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        switch_core_destroy_memory_pool(&amp;oglobals.pool);
+
</ins><span class="cx">         return status;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>

</body>
</html>