]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
There is no need to use the struct ast_party_connected_line.source update values.
authorRichard Mudgett <rmudgett@digium.com>
Fri, 24 Apr 2009 17:59:01 +0000 (17:59 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Fri, 24 Apr 2009 17:59:01 +0000 (17:59 +0000)
The messages sent by a technology when a connected line update is received
are best determined by the current call state of the channel.  The struct
ast_party_connected_line.source value is really only useful as a possible
tracing aid.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@190517 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_misdn.c
funcs/func_connectedline.c

index 5360ba40ce09cb1f92b25e552937965cd7dc9921..f743ec8d1714f006d412682b9b80559906db799c 100644 (file)
@@ -6041,7 +6041,6 @@ static void misdn_get_connected_line(struct ast_channel *ast, struct misdn_bchan
  */
 static void misdn_update_connected_line(struct ast_channel *ast, struct misdn_bchannel *bc, int originator)
 {
-       int Is_PTMP;
        struct chan_list *ch;
 
        misdn_get_connected_line(ast, bc, originator);
@@ -6051,51 +6050,23 @@ static void misdn_update_connected_line(struct ast_channel *ast, struct misdn_bc
                bc->redirecting.to = bc->caller;
        }
 
-       Is_PTMP = !misdn_lib_is_ptp(bc->port);
-       switch (ast->connected.source) {
-       case AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER:
-       case AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER:
-               ch = MISDN_ASTERISK_TECH_PVT(ast);
-               if (ch->state == MISDN_CONNECTED
-                       || originator != ORG_MISDN) {
-                       if (Is_PTMP) {
-                               /* Send NOTIFY(transfer-active, redirecting.to data) */
-                               bc->redirecting.to_changed = 1;
-                               bc->notify_description_code = mISDN_NOTIFY_CODE_CALL_TRANSFER_ACTIVE;
-                               misdn_lib_send_event(bc, EVENT_NOTIFY);
-#if defined(AST_MISDN_ENHANCEMENTS)
-                       } else {
-                               /* Send EctInform(transfer-active, redirecting.to data) */
-                               bc->fac_out.Function = Fac_EctInform;
-                               bc->fac_out.u.EctInform.InvokeID = ++misdn_invoke_id;
-                               bc->fac_out.u.EctInform.Status = 1;/* active */
-                               if (bc->redirecting.to.number[0]) {
-                                       misdn_PresentedNumberUnscreened_fill(&bc->fac_out.u.EctInform.Redirection,
-                                               &bc->redirecting.to);
-                                       bc->fac_out.u.EctInform.RedirectionPresent = 1;
-                               } else {
-                                       bc->fac_out.u.EctInform.RedirectionPresent = 0;
-                               }
+       ch = MISDN_ASTERISK_TECH_PVT(ast);
+       if (ch->state == MISDN_CONNECTED
+               || originator != ORG_MISDN) {
+               int is_ptmp;
 
-                               /* Send message */
-                               print_facility(&bc->fac_out, bc);
-                               misdn_lib_send_event(bc, EVENT_FACILITY);
-#endif /* defined(AST_MISDN_ENHANCEMENTS) */
-                       }
-               }
-               break;
-       case AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER_ALERTING:
-               if (Is_PTMP) {
-                       /* Send NOTIFY(transfer-alerting, redirecting.to data) */
+               is_ptmp = !misdn_lib_is_ptp(bc->port);
+               if (is_ptmp) {
+                       /* Send NOTIFY(transfer-active, redirecting.to data) */
                        bc->redirecting.to_changed = 1;
-                       bc->notify_description_code = mISDN_NOTIFY_CODE_CALL_TRANSFER_ALERTING;
+                       bc->notify_description_code = mISDN_NOTIFY_CODE_CALL_TRANSFER_ACTIVE;
                        misdn_lib_send_event(bc, EVENT_NOTIFY);
 #if defined(AST_MISDN_ENHANCEMENTS)
                } else {
-                       /* Send EctInform(transfer-alerting, redirecting.to data) */
+                       /* Send EctInform(transfer-active, redirecting.to data) */
                        bc->fac_out.Function = Fac_EctInform;
                        bc->fac_out.u.EctInform.InvokeID = ++misdn_invoke_id;
-                       bc->fac_out.u.EctInform.Status = 0;/* alerting */
+                       bc->fac_out.u.EctInform.Status = 1;/* active */
                        if (bc->redirecting.to.number[0]) {
                                misdn_PresentedNumberUnscreened_fill(&bc->fac_out.u.EctInform.Redirection,
                                        &bc->redirecting.to);
@@ -6103,13 +6074,12 @@ static void misdn_update_connected_line(struct ast_channel *ast, struct misdn_bc
                        } else {
                                bc->fac_out.u.EctInform.RedirectionPresent = 0;
                        }
+
+                       /* Send message */
                        print_facility(&bc->fac_out, bc);
                        misdn_lib_send_event(bc, EVENT_FACILITY);
 #endif /* defined(AST_MISDN_ENHANCEMENTS) */
                }
-               break;
-       default:
-               break;
        }
 }
 
@@ -8829,6 +8799,15 @@ static void misdn_facility_ie_handler(enum event_e event, struct misdn_bchannel
                        misdn_add_number_prefix(bc->port, party_id.number_type,
                                party_id.number, sizeof(party_id.number));
 
+                       /*
+                        * It would be preferable to update the connected line information
+                        * only when the message callStatus is active.  However, the
+                        * optional redirection number may not be present in the active
+                        * message if an alerting message were received earlier.
+                        *
+                        * The consequences if we wind up sending two updates is benign.
+                        * The other end will think that it got transferred twice.
+                        */
                        misdn_queue_connected_line_update(ch->ast, &party_id,
                                (bc->fac_in.u.EctInform.Status == 0 /* alerting */)
                                        ? AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER_ALERTING
@@ -10220,6 +10199,15 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
                        }
                        break;
                case mISDN_NOTIFY_CODE_CALL_TRANSFER_ALERTING:
+                       /*
+                        * It would be preferable to update the connected line information
+                        * only when the message callStatus is active.  However, the
+                        * optional redirection number may not be present in the active
+                        * message if an alerting message were received earlier.
+                        *
+                        * The consequences if we wind up sending two updates is benign.
+                        * The other end will think that it got transferred twice.
+                        */
                        if (bc->redirecting.to_changed) {
                                bc->redirecting.to_changed = 0;
                                if (ch && ch->ast) {
index 68e8af4fa4ec28304af19f1ba3baeab52bd8a623..7e1d9b457f94761ed01c551e4762282bf764ece0 100644 (file)
@@ -19,7 +19,7 @@
 /*! \file
  *
  * \brief Connected Line dialplan function
- * 
+ *
  * \ingroup functions
  */
 
@@ -41,6 +41,11 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include "asterisk/options.h"
 #include "asterisk/callerid.h"
 
+/*
+ * Do not document the CONNECTEDLINE(source) datatype.
+ * It has turned out to not be needed.  The source value is really                                      .
+ * only useful as a possible tracing aid.
+ */
 /*** DOCUMENTATION
        <function name="CONNECTEDLINE" language="en_US">
                <synopsis>
@@ -55,7 +60,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                                        <enum name = "name" />
                                        <enum name = "ton" />
                                        <enum name = "pres" />
-                                       <enum name = "source" />
                                </enumlist>
                        </parameter>
                        <parameter name="i">
@@ -64,13 +68,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                        </parameter>
                </syntax>
                <description>
-                       <para>Gets or sets Connected Line data on the channel. Possible values
-                       for the <replaceable>source</replaceable> datatype are:</para>
-                       <enumlist>
-                               <enum name="answer"><para>Normal Call Answering</para></enum>
-                               <enum name="transfer_alerting"><para>Call Transfer(Alerting)</para></enum>
-                               <enum name="transfer_active"><para>Call Transfer(Active)</para></enum>
-                       </enumlist>
+                       <para>Gets or sets Connected Line data on the channel.</para>
                </description>
        </function>
  ***/
@@ -133,7 +131,7 @@ static int connectedline_write(struct ast_channel *chan, const char *cmd, char *
                case 'i':
                        set_it = ast_channel_set_connected_line;
                        break;
-               
+
                default:
                        ast_log(LOG_ERROR, "Unknown connectedline option '%s'.\n", option);
                        return 0;
@@ -161,7 +159,7 @@ static int connectedline_write(struct ast_channel *chan, const char *cmd, char *
                connected.id.name = ast_strdupa(value);
                ast_trim_blanks(connected.id.name);
                set_it(chan, &connected);
-       } else if (!strncasecmp("num", data, 3)) { 
+       } else if (!strncasecmp("num", data, 3)) {
                connected.id.number = ast_strdupa(value);
                ast_trim_blanks(connected.id.number);
                set_it(chan, &connected);