2005-05-15 17:45:30 +00:00
|
|
|
/*
|
2005-09-14 20:46:50 +00:00
|
|
|
* Asterisk -- An open source telephony toolkit.
|
2005-05-15 17:45:30 +00:00
|
|
|
*
|
2010-07-14 15:48:36 +00:00
|
|
|
* Copyright (C) 1999-2010, Digium, Inc.
|
2005-09-14 20:46:50 +00:00
|
|
|
*
|
|
|
|
* See http://www.asterisk.org for more information about
|
|
|
|
* the Asterisk project. Please do not directly contact
|
|
|
|
* any of the maintainers of this project for assistance;
|
|
|
|
* the project provides a web site, mailing lists and IRC
|
|
|
|
* channels for your use.
|
2005-05-15 17:45:30 +00:00
|
|
|
*
|
|
|
|
* This program is free software, distributed under the terms of
|
2005-09-14 20:46:50 +00:00
|
|
|
* the GNU General Public License Version 2. See the LICENSE file
|
|
|
|
* at the top of the source tree.
|
|
|
|
*/
|
|
|
|
|
2005-10-24 20:12:06 +00:00
|
|
|
/*! \file
|
2005-09-14 20:46:50 +00:00
|
|
|
*
|
2010-07-14 15:48:36 +00:00
|
|
|
* \brief Party ID related dialplan functions (Caller-ID, Connected-line, Redirecting)
|
2009-09-27 20:40:16 +00:00
|
|
|
*
|
2007-01-24 09:05:29 +00:00
|
|
|
* \ingroup functions
|
2010-07-14 15:48:36 +00:00
|
|
|
*
|
|
|
|
* See Also:
|
|
|
|
* \arg \ref AstCREDITS
|
2005-05-15 17:45:30 +00:00
|
|
|
*/
|
|
|
|
|
2011-07-14 20:28:54 +00:00
|
|
|
/*** MODULEINFO
|
|
|
|
<support_level>core</support_level>
|
|
|
|
***/
|
|
|
|
|
2006-06-07 18:54:56 +00:00
|
|
|
#include "asterisk.h"
|
|
|
|
|
2005-05-15 17:45:30 +00:00
|
|
|
#include "asterisk/module.h"
|
|
|
|
#include "asterisk/channel.h"
|
|
|
|
#include "asterisk/pbx.h"
|
|
|
|
#include "asterisk/utils.h"
|
|
|
|
#include "asterisk/app.h"
|
2005-07-25 18:34:40 +00:00
|
|
|
#include "asterisk/callerid.h"
|
2005-05-15 17:45:30 +00:00
|
|
|
|
2010-07-14 15:48:36 +00:00
|
|
|
/*
|
2015-11-06 13:54:59 +00:00
|
|
|
* The CALLERID(pres) datatype is shorthand for getting/setting the
|
|
|
|
* combined value of name-pres and num-pres. Some channel drivers
|
|
|
|
* don't make a distinction, so it makes sense to only use one property
|
|
|
|
* to get/set it. The same applies to CONNECTEDLINE(pres),
|
|
|
|
* REDIRECTING(orig-pres), REDIRECTING(from-pres) and REDIRECTING(to-pres).
|
2010-07-14 15:48:36 +00:00
|
|
|
*
|
|
|
|
* Do not document the CALLERID(ton) datatype.
|
|
|
|
* It is an alias for num-plan.
|
|
|
|
*
|
2010-07-14 16:58:03 +00:00
|
|
|
* Do not document the CALLERID(ANI-subaddr-...) datatype.
|
|
|
|
* This is not used.
|
|
|
|
*
|
2010-07-14 15:48:36 +00:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* Do not document the CONNECTEDLINE(ton) datatype.
|
|
|
|
* It is an alias for num-plan.
|
|
|
|
*
|
|
|
|
* Do not document the REDIRECTING(pres) datatype.
|
|
|
|
* It has turned out that the from-pres and to-pres values must be kept
|
|
|
|
* separate. They represent two different parties and there is a case when
|
|
|
|
* they are active at the same time. The plain pres option will simply
|
|
|
|
* live on as a historical relic.
|
|
|
|
*
|
2012-04-20 00:57:13 +00:00
|
|
|
* Do not document the REDIRECTING(orig-ton), REDIRECTING(from-ton),
|
|
|
|
* or REDIRECTING(to-ton) datatypes.
|
|
|
|
* They are aliases for orig-num-plan, from-num-plan, and to-num-plan
|
|
|
|
* respectively.
|
2010-07-14 15:48:36 +00:00
|
|
|
*/
|
2008-11-01 21:10:07 +00:00
|
|
|
/*** DOCUMENTATION
|
|
|
|
<function name="CALLERID" language="en_US">
|
|
|
|
<synopsis>
|
|
|
|
Gets or sets Caller*ID data on the channel.
|
|
|
|
</synopsis>
|
|
|
|
<syntax>
|
|
|
|
<parameter name="datatype" required="true">
|
|
|
|
<para>The allowable datatypes are:</para>
|
|
|
|
<enumlist>
|
2010-07-14 15:48:36 +00:00
|
|
|
<enum name = "all" />
|
|
|
|
<enum name = "name" />
|
|
|
|
<enum name = "name-valid" />
|
|
|
|
<enum name = "name-charset" />
|
|
|
|
<enum name = "name-pres" />
|
|
|
|
<enum name = "num" />
|
|
|
|
<enum name = "num-valid" />
|
|
|
|
<enum name = "num-plan" />
|
|
|
|
<enum name = "num-pres" />
|
2015-11-06 13:54:59 +00:00
|
|
|
<enum name = "pres" />
|
2010-07-14 15:48:36 +00:00
|
|
|
<enum name = "subaddr" />
|
|
|
|
<enum name = "subaddr-valid" />
|
|
|
|
<enum name = "subaddr-type" />
|
|
|
|
<enum name = "subaddr-odd" />
|
|
|
|
<enum name = "tag" />
|
Add private representation of caller, connected and redirecting party ids.
This patch adds the feature "Private representation of caller, connected
and redirecting party ids", as previously discussed with us (DATUS) and
Digium.
1. Feature motivation
Until now it is quite difficult to modify a party number or name which can
only be seen by exactly one particular instantiated technology channel
subscriber. One example where a modified party number or name on one
channel is spread over several channels are supplementary services like
call transfer or pickup. To implement these features Asterisk internally
copies caller and connected ids from one channel to another. Another
example are extension subscriptions. The monitoring entities (watchers)
are notified of state changes and - if desired - of party numbers or names
which represent the involving call parties. One major feature where a
private representation of party names is essentially needed, i.e. where a
party name shall be exclusively signaled to only one particular user, is a
private user-specific name resolution for party numbers. A lookup in a
private destination-dependent telephone book shall provide party names
which cannot be seen by any other user at any time.
2. Feature Description
This feature comes along with the implementation of additional private
party id elements for caller id, connected id and redirecting ids inside
Asterisk channels.
The private party id elements can be read or set by the user using
Asterisk dialplan functions.
When a technology channel is initiating a call, receives an internal
connected-line update event, or receives an internal redirecting update
event, it merges the corresponding public id with the private id to create
an effective party id. The effective party id is then used for protocol
signaling.
The channel technologies which initially support the private id
representation with this patch are SIP (chan_sip), mISDN (chan_misdn) and
PRI (chan_dahdi).
Once a private name or number on a channel is set and (implicitly) made
valid, it is generally used for any further protocol signaling until it is
rewritten or invalidated.
To simplify the invalidation of private ids all internally generated
connected/redirecting update events and also all connected/redirecting
update events which are generated by technology channels -- receiving
regarding protocol information - automatically trigger the invalidation of
private ids.
If not using the private party id representation feature at all, i.e. if
using only the 'regular' caller-id, connected and redirecting related
functions, the current characteristic of Asterisk is not affected by the
new extended functionality.
3. User interface Description
To grant access to the private name and number representation from the
Asterisk dialplan, the CALLERID, CONNECTEDLINE and REDIRECTING dialplan
functions are extended by the following data types. The formats of these
data types are equal to the corresponding regular 'non-private' already
existing data types:
CALLERID:
priv-all
priv-name priv-name-valid priv-name-charset priv-name-pres
priv-num priv-num-valid priv-num-plan priv-num-pres
priv-subaddr priv-subaddr-valid priv-subaddr-type priv-subaddr-odd
priv-tag
CONNECTEDLINE:
priv-name priv-name-valid priv-name-pres priv-name-charset
priv-num priv-num-valid priv-num-pres priv-num-plan
priv-subaddr priv-subaddr-valid priv-subaddr-type priv-subaddr-odd
priv-tag
REDIRECTING:
priv-orig-name priv-orig-name-valid priv-orig-name-pres priv-orig-name-charset
priv-orig-num priv-orig-num-valid priv-orig-num-pres priv-orig-num-plan
priv-orig-subaddr priv-orig-subaddr-valid priv-orig-subaddr-type priv-orig-subaddr-odd
priv-orig-tag
priv-from-name priv-from-name-valid priv-from-name-pres priv-from-name-charset
priv-from-num priv-from-num-valid priv-from-num-pres priv-from-num-plan
priv-from-subaddr priv-from-subaddr-valid priv-from-subaddr-type priv-from-subaddr-odd
priv-from-tag
priv-to-name priv-to-name-valid priv-to-name-pres priv-to-name-charset
priv-to-num priv-to-num-valid priv-to-num-pres priv-to-num-plan
priv-to-subaddr priv-to-subaddr-valid priv-to-subaddr-type priv-to-subaddr-odd
priv-to-tag
Reported by: Thomas Arimont
Review: https://reviewboard.asterisk.org/r/2030/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@371120 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-10 19:54:55 +00:00
|
|
|
<enum name = "priv-all" />
|
|
|
|
<enum name = "priv-name" />
|
|
|
|
<enum name = "priv-name-valid" />
|
|
|
|
<enum name = "priv-name-charset" />
|
|
|
|
<enum name = "priv-name-pres" />
|
|
|
|
<enum name = "priv-num" />
|
|
|
|
<enum name = "priv-num-valid" />
|
|
|
|
<enum name = "priv-num-plan" />
|
|
|
|
<enum name = "priv-num-pres" />
|
|
|
|
<enum name = "priv-subaddr" />
|
|
|
|
<enum name = "priv-subaddr-valid" />
|
|
|
|
<enum name = "priv-subaddr-type" />
|
|
|
|
<enum name = "priv-subaddr-odd" />
|
|
|
|
<enum name = "priv-tag" />
|
2010-07-14 16:58:03 +00:00
|
|
|
<enum name = "ANI-all" />
|
|
|
|
<enum name = "ANI-name" />
|
|
|
|
<enum name = "ANI-name-valid" />
|
|
|
|
<enum name = "ANI-name-charset" />
|
|
|
|
<enum name = "ANI-name-pres" />
|
|
|
|
<enum name = "ANI-num" />
|
|
|
|
<enum name = "ANI-num-valid" />
|
|
|
|
<enum name = "ANI-num-plan" />
|
|
|
|
<enum name = "ANI-num-pres" />
|
|
|
|
<enum name = "ANI-tag" />
|
2010-07-14 15:48:36 +00:00
|
|
|
<enum name = "RDNIS" />
|
|
|
|
<enum name = "DNID" />
|
|
|
|
<enum name = "dnid-num-plan" />
|
|
|
|
<enum name = "dnid-subaddr" />
|
|
|
|
<enum name = "dnid-subaddr-valid" />
|
|
|
|
<enum name = "dnid-subaddr-type" />
|
|
|
|
<enum name = "dnid-subaddr-odd" />
|
2008-11-01 21:10:07 +00:00
|
|
|
</enumlist>
|
|
|
|
</parameter>
|
|
|
|
<parameter name="CID">
|
2011-10-20 20:48:31 +00:00
|
|
|
<para>Optional Caller*ID to parse instead of using the Caller*ID from the
|
2011-10-20 21:28:31 +00:00
|
|
|
channel. This parameter is only optional when reading the Caller*ID.</para>
|
2008-11-01 21:10:07 +00:00
|
|
|
</parameter>
|
|
|
|
</syntax>
|
|
|
|
<description>
|
2010-07-14 15:48:36 +00:00
|
|
|
<para>Gets or sets Caller*ID data on the channel. Uses channel callerid by
|
|
|
|
default or optional callerid, if specified.</para>
|
2015-11-06 13:54:59 +00:00
|
|
|
<para>The <replaceable>pres</replaceable> field gets/sets a combined value
|
|
|
|
for <replaceable>name-pres</replaceable> and
|
|
|
|
<replaceable>num-pres</replaceable>.</para>
|
2010-07-14 15:48:36 +00:00
|
|
|
<para>The allowable values for the <replaceable>name-charset</replaceable>
|
|
|
|
field are the following:</para>
|
|
|
|
<enumlist>
|
|
|
|
<enum name = "unknown"><para>Unknown</para></enum>
|
|
|
|
<enum name = "iso8859-1"><para>ISO8859-1</para></enum>
|
|
|
|
<enum name = "withdrawn"><para>Withdrawn</para></enum>
|
|
|
|
<enum name = "iso8859-2"><para>ISO8859-2</para></enum>
|
|
|
|
<enum name = "iso8859-3"><para>ISO8859-3</para></enum>
|
|
|
|
<enum name = "iso8859-4"><para>ISO8859-4</para></enum>
|
|
|
|
<enum name = "iso8859-5"><para>ISO8859-5</para></enum>
|
|
|
|
<enum name = "iso8859-7"><para>ISO8859-7</para></enum>
|
|
|
|
<enum name = "bmp"><para>ISO10646 Bmp String</para></enum>
|
|
|
|
<enum name = "utf8"><para>ISO10646 UTF-8 String</para></enum>
|
|
|
|
</enumlist>
|
2008-11-01 21:10:07 +00:00
|
|
|
</description>
|
|
|
|
</function>
|
|
|
|
<function name="CALLERPRES" language="en_US">
|
|
|
|
<synopsis>
|
|
|
|
Gets or sets Caller*ID presentation on the channel.
|
|
|
|
</synopsis>
|
|
|
|
<syntax />
|
|
|
|
<description>
|
2010-07-14 15:48:36 +00:00
|
|
|
<para>Gets or sets Caller*ID presentation on the channel.
|
|
|
|
This function is deprecated in favor of CALLERID(num-pres)
|
2015-11-06 13:54:59 +00:00
|
|
|
and CALLERID(name-pres) or CALLERID(pres) to get/set both
|
|
|
|
at once.
|
2010-07-14 15:48:36 +00:00
|
|
|
The following values are valid:</para>
|
2008-11-01 21:10:07 +00:00
|
|
|
<enumlist>
|
|
|
|
<enum name="allowed_not_screened">
|
|
|
|
<para>Presentation Allowed, Not Screened.</para>
|
|
|
|
</enum>
|
|
|
|
<enum name="allowed_passed_screen">
|
|
|
|
<para>Presentation Allowed, Passed Screen.</para>
|
|
|
|
</enum>
|
|
|
|
<enum name="allowed_failed_screen">
|
|
|
|
<para>Presentation Allowed, Failed Screen.</para>
|
|
|
|
</enum>
|
|
|
|
<enum name="allowed">
|
|
|
|
<para>Presentation Allowed, Network Number.</para>
|
|
|
|
</enum>
|
|
|
|
<enum name="prohib_not_screened">
|
|
|
|
<para>Presentation Prohibited, Not Screened.</para>
|
|
|
|
</enum>
|
|
|
|
<enum name="prohib_passed_screen">
|
|
|
|
<para>Presentation Prohibited, Passed Screen.</para>
|
|
|
|
</enum>
|
|
|
|
<enum name="prohib_failed_screen">
|
|
|
|
<para>Presentation Prohibited, Failed Screen.</para>
|
|
|
|
</enum>
|
|
|
|
<enum name="prohib">
|
|
|
|
<para>Presentation Prohibited, Network Number.</para>
|
|
|
|
</enum>
|
|
|
|
<enum name="unavailable">
|
|
|
|
<para>Number Unavailable.</para>
|
|
|
|
</enum>
|
|
|
|
</enumlist>
|
|
|
|
</description>
|
|
|
|
</function>
|
2010-07-14 15:48:36 +00:00
|
|
|
<function name="CONNECTEDLINE" language="en_US">
|
|
|
|
<synopsis>
|
|
|
|
Gets or sets Connected Line data on the channel.
|
|
|
|
</synopsis>
|
|
|
|
<syntax>
|
|
|
|
<parameter name="datatype" required="true">
|
|
|
|
<para>The allowable datatypes are:</para>
|
|
|
|
<enumlist>
|
|
|
|
<enum name = "all" />
|
|
|
|
<enum name = "name" />
|
|
|
|
<enum name = "name-valid" />
|
|
|
|
<enum name = "name-charset" />
|
|
|
|
<enum name = "name-pres" />
|
|
|
|
<enum name = "num" />
|
|
|
|
<enum name = "num-valid" />
|
|
|
|
<enum name = "num-plan" />
|
|
|
|
<enum name = "num-pres" />
|
2015-11-06 13:54:59 +00:00
|
|
|
<enum name = "pres" />
|
2010-07-14 15:48:36 +00:00
|
|
|
<enum name = "subaddr" />
|
|
|
|
<enum name = "subaddr-valid" />
|
|
|
|
<enum name = "subaddr-type" />
|
|
|
|
<enum name = "subaddr-odd" />
|
|
|
|
<enum name = "tag" />
|
Add private representation of caller, connected and redirecting party ids.
This patch adds the feature "Private representation of caller, connected
and redirecting party ids", as previously discussed with us (DATUS) and
Digium.
1. Feature motivation
Until now it is quite difficult to modify a party number or name which can
only be seen by exactly one particular instantiated technology channel
subscriber. One example where a modified party number or name on one
channel is spread over several channels are supplementary services like
call transfer or pickup. To implement these features Asterisk internally
copies caller and connected ids from one channel to another. Another
example are extension subscriptions. The monitoring entities (watchers)
are notified of state changes and - if desired - of party numbers or names
which represent the involving call parties. One major feature where a
private representation of party names is essentially needed, i.e. where a
party name shall be exclusively signaled to only one particular user, is a
private user-specific name resolution for party numbers. A lookup in a
private destination-dependent telephone book shall provide party names
which cannot be seen by any other user at any time.
2. Feature Description
This feature comes along with the implementation of additional private
party id elements for caller id, connected id and redirecting ids inside
Asterisk channels.
The private party id elements can be read or set by the user using
Asterisk dialplan functions.
When a technology channel is initiating a call, receives an internal
connected-line update event, or receives an internal redirecting update
event, it merges the corresponding public id with the private id to create
an effective party id. The effective party id is then used for protocol
signaling.
The channel technologies which initially support the private id
representation with this patch are SIP (chan_sip), mISDN (chan_misdn) and
PRI (chan_dahdi).
Once a private name or number on a channel is set and (implicitly) made
valid, it is generally used for any further protocol signaling until it is
rewritten or invalidated.
To simplify the invalidation of private ids all internally generated
connected/redirecting update events and also all connected/redirecting
update events which are generated by technology channels -- receiving
regarding protocol information - automatically trigger the invalidation of
private ids.
If not using the private party id representation feature at all, i.e. if
using only the 'regular' caller-id, connected and redirecting related
functions, the current characteristic of Asterisk is not affected by the
new extended functionality.
3. User interface Description
To grant access to the private name and number representation from the
Asterisk dialplan, the CALLERID, CONNECTEDLINE and REDIRECTING dialplan
functions are extended by the following data types. The formats of these
data types are equal to the corresponding regular 'non-private' already
existing data types:
CALLERID:
priv-all
priv-name priv-name-valid priv-name-charset priv-name-pres
priv-num priv-num-valid priv-num-plan priv-num-pres
priv-subaddr priv-subaddr-valid priv-subaddr-type priv-subaddr-odd
priv-tag
CONNECTEDLINE:
priv-name priv-name-valid priv-name-pres priv-name-charset
priv-num priv-num-valid priv-num-pres priv-num-plan
priv-subaddr priv-subaddr-valid priv-subaddr-type priv-subaddr-odd
priv-tag
REDIRECTING:
priv-orig-name priv-orig-name-valid priv-orig-name-pres priv-orig-name-charset
priv-orig-num priv-orig-num-valid priv-orig-num-pres priv-orig-num-plan
priv-orig-subaddr priv-orig-subaddr-valid priv-orig-subaddr-type priv-orig-subaddr-odd
priv-orig-tag
priv-from-name priv-from-name-valid priv-from-name-pres priv-from-name-charset
priv-from-num priv-from-num-valid priv-from-num-pres priv-from-num-plan
priv-from-subaddr priv-from-subaddr-valid priv-from-subaddr-type priv-from-subaddr-odd
priv-from-tag
priv-to-name priv-to-name-valid priv-to-name-pres priv-to-name-charset
priv-to-num priv-to-num-valid priv-to-num-pres priv-to-num-plan
priv-to-subaddr priv-to-subaddr-valid priv-to-subaddr-type priv-to-subaddr-odd
priv-to-tag
Reported by: Thomas Arimont
Review: https://reviewboard.asterisk.org/r/2030/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@371120 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-10 19:54:55 +00:00
|
|
|
<enum name = "priv-all" />
|
|
|
|
<enum name = "priv-name" />
|
|
|
|
<enum name = "priv-name-valid" />
|
|
|
|
<enum name = "priv-name-charset" />
|
|
|
|
<enum name = "priv-name-pres" />
|
|
|
|
<enum name = "priv-num" />
|
|
|
|
<enum name = "priv-num-valid" />
|
|
|
|
<enum name = "priv-num-plan" />
|
|
|
|
<enum name = "priv-num-pres" />
|
|
|
|
<enum name = "priv-subaddr" />
|
|
|
|
<enum name = "priv-subaddr-valid" />
|
|
|
|
<enum name = "priv-subaddr-type" />
|
|
|
|
<enum name = "priv-subaddr-odd" />
|
|
|
|
<enum name = "priv-tag" />
|
2010-07-14 15:48:36 +00:00
|
|
|
</enumlist>
|
|
|
|
</parameter>
|
|
|
|
<parameter name="i">
|
|
|
|
<para>If set, this will prevent the channel from sending out protocol
|
|
|
|
messages because of the value being set</para>
|
|
|
|
</parameter>
|
|
|
|
</syntax>
|
|
|
|
<description>
|
|
|
|
<para>Gets or sets Connected Line data on the channel.</para>
|
2015-11-06 13:54:59 +00:00
|
|
|
<para>The <replaceable>pres</replaceable> field gets/sets a combined value
|
|
|
|
for <replaceable>name-pres</replaceable> and
|
|
|
|
<replaceable>num-pres</replaceable>.</para>
|
2010-07-14 15:48:36 +00:00
|
|
|
<para>The allowable values for the <replaceable>name-charset</replaceable>
|
|
|
|
field are the following:</para>
|
|
|
|
<enumlist>
|
|
|
|
<enum name = "unknown"><para>Unknown</para></enum>
|
|
|
|
<enum name = "iso8859-1"><para>ISO8859-1</para></enum>
|
|
|
|
<enum name = "withdrawn"><para>Withdrawn</para></enum>
|
|
|
|
<enum name = "iso8859-2"><para>ISO8859-2</para></enum>
|
|
|
|
<enum name = "iso8859-3"><para>ISO8859-3</para></enum>
|
|
|
|
<enum name = "iso8859-4"><para>ISO8859-4</para></enum>
|
|
|
|
<enum name = "iso8859-5"><para>ISO8859-5</para></enum>
|
|
|
|
<enum name = "iso8859-7"><para>ISO8859-7</para></enum>
|
|
|
|
<enum name = "bmp"><para>ISO10646 Bmp String</para></enum>
|
|
|
|
<enum name = "utf8"><para>ISO10646 UTF-8 String</para></enum>
|
|
|
|
</enumlist>
|
|
|
|
</description>
|
|
|
|
</function>
|
|
|
|
<function name="REDIRECTING" language="en_US">
|
|
|
|
<synopsis>
|
|
|
|
Gets or sets Redirecting data on the channel.
|
|
|
|
</synopsis>
|
|
|
|
<syntax>
|
|
|
|
<parameter name="datatype" required="true">
|
|
|
|
<para>The allowable datatypes are:</para>
|
|
|
|
<enumlist>
|
2012-04-20 00:57:13 +00:00
|
|
|
<enum name = "orig-all" />
|
|
|
|
<enum name = "orig-name" />
|
|
|
|
<enum name = "orig-name-valid" />
|
|
|
|
<enum name = "orig-name-charset" />
|
|
|
|
<enum name = "orig-name-pres" />
|
|
|
|
<enum name = "orig-num" />
|
|
|
|
<enum name = "orig-num-valid" />
|
|
|
|
<enum name = "orig-num-plan" />
|
|
|
|
<enum name = "orig-num-pres" />
|
2015-11-06 13:54:59 +00:00
|
|
|
<enum name = "orig-pres" />
|
2012-04-20 00:57:13 +00:00
|
|
|
<enum name = "orig-subaddr" />
|
|
|
|
<enum name = "orig-subaddr-valid" />
|
|
|
|
<enum name = "orig-subaddr-type" />
|
|
|
|
<enum name = "orig-subaddr-odd" />
|
|
|
|
<enum name = "orig-tag" />
|
|
|
|
<enum name = "orig-reason" />
|
2010-07-14 15:48:36 +00:00
|
|
|
<enum name = "from-all" />
|
|
|
|
<enum name = "from-name" />
|
|
|
|
<enum name = "from-name-valid" />
|
|
|
|
<enum name = "from-name-charset" />
|
|
|
|
<enum name = "from-name-pres" />
|
|
|
|
<enum name = "from-num" />
|
|
|
|
<enum name = "from-num-valid" />
|
|
|
|
<enum name = "from-num-plan" />
|
|
|
|
<enum name = "from-num-pres" />
|
2015-11-06 13:54:59 +00:00
|
|
|
<enum name = "from-pres" />
|
2010-07-14 15:48:36 +00:00
|
|
|
<enum name = "from-subaddr" />
|
|
|
|
<enum name = "from-subaddr-valid" />
|
|
|
|
<enum name = "from-subaddr-type" />
|
|
|
|
<enum name = "from-subaddr-odd" />
|
|
|
|
<enum name = "from-tag" />
|
|
|
|
<enum name = "to-all" />
|
|
|
|
<enum name = "to-name" />
|
|
|
|
<enum name = "to-name-valid" />
|
|
|
|
<enum name = "to-name-charset" />
|
|
|
|
<enum name = "to-name-pres" />
|
|
|
|
<enum name = "to-num" />
|
|
|
|
<enum name = "to-num-valid" />
|
|
|
|
<enum name = "to-num-plan" />
|
|
|
|
<enum name = "to-num-pres" />
|
2015-11-06 13:54:59 +00:00
|
|
|
<enum name = "to-pres" />
|
2010-07-14 15:48:36 +00:00
|
|
|
<enum name = "to-subaddr" />
|
|
|
|
<enum name = "to-subaddr-valid" />
|
|
|
|
<enum name = "to-subaddr-type" />
|
|
|
|
<enum name = "to-subaddr-odd" />
|
|
|
|
<enum name = "to-tag" />
|
Add private representation of caller, connected and redirecting party ids.
This patch adds the feature "Private representation of caller, connected
and redirecting party ids", as previously discussed with us (DATUS) and
Digium.
1. Feature motivation
Until now it is quite difficult to modify a party number or name which can
only be seen by exactly one particular instantiated technology channel
subscriber. One example where a modified party number or name on one
channel is spread over several channels are supplementary services like
call transfer or pickup. To implement these features Asterisk internally
copies caller and connected ids from one channel to another. Another
example are extension subscriptions. The monitoring entities (watchers)
are notified of state changes and - if desired - of party numbers or names
which represent the involving call parties. One major feature where a
private representation of party names is essentially needed, i.e. where a
party name shall be exclusively signaled to only one particular user, is a
private user-specific name resolution for party numbers. A lookup in a
private destination-dependent telephone book shall provide party names
which cannot be seen by any other user at any time.
2. Feature Description
This feature comes along with the implementation of additional private
party id elements for caller id, connected id and redirecting ids inside
Asterisk channels.
The private party id elements can be read or set by the user using
Asterisk dialplan functions.
When a technology channel is initiating a call, receives an internal
connected-line update event, or receives an internal redirecting update
event, it merges the corresponding public id with the private id to create
an effective party id. The effective party id is then used for protocol
signaling.
The channel technologies which initially support the private id
representation with this patch are SIP (chan_sip), mISDN (chan_misdn) and
PRI (chan_dahdi).
Once a private name or number on a channel is set and (implicitly) made
valid, it is generally used for any further protocol signaling until it is
rewritten or invalidated.
To simplify the invalidation of private ids all internally generated
connected/redirecting update events and also all connected/redirecting
update events which are generated by technology channels -- receiving
regarding protocol information - automatically trigger the invalidation of
private ids.
If not using the private party id representation feature at all, i.e. if
using only the 'regular' caller-id, connected and redirecting related
functions, the current characteristic of Asterisk is not affected by the
new extended functionality.
3. User interface Description
To grant access to the private name and number representation from the
Asterisk dialplan, the CALLERID, CONNECTEDLINE and REDIRECTING dialplan
functions are extended by the following data types. The formats of these
data types are equal to the corresponding regular 'non-private' already
existing data types:
CALLERID:
priv-all
priv-name priv-name-valid priv-name-charset priv-name-pres
priv-num priv-num-valid priv-num-plan priv-num-pres
priv-subaddr priv-subaddr-valid priv-subaddr-type priv-subaddr-odd
priv-tag
CONNECTEDLINE:
priv-name priv-name-valid priv-name-pres priv-name-charset
priv-num priv-num-valid priv-num-pres priv-num-plan
priv-subaddr priv-subaddr-valid priv-subaddr-type priv-subaddr-odd
priv-tag
REDIRECTING:
priv-orig-name priv-orig-name-valid priv-orig-name-pres priv-orig-name-charset
priv-orig-num priv-orig-num-valid priv-orig-num-pres priv-orig-num-plan
priv-orig-subaddr priv-orig-subaddr-valid priv-orig-subaddr-type priv-orig-subaddr-odd
priv-orig-tag
priv-from-name priv-from-name-valid priv-from-name-pres priv-from-name-charset
priv-from-num priv-from-num-valid priv-from-num-pres priv-from-num-plan
priv-from-subaddr priv-from-subaddr-valid priv-from-subaddr-type priv-from-subaddr-odd
priv-from-tag
priv-to-name priv-to-name-valid priv-to-name-pres priv-to-name-charset
priv-to-num priv-to-num-valid priv-to-num-pres priv-to-num-plan
priv-to-subaddr priv-to-subaddr-valid priv-to-subaddr-type priv-to-subaddr-odd
priv-to-tag
Reported by: Thomas Arimont
Review: https://reviewboard.asterisk.org/r/2030/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@371120 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-10 19:54:55 +00:00
|
|
|
<enum name = "priv-orig-all" />
|
|
|
|
<enum name = "priv-orig-name" />
|
|
|
|
<enum name = "priv-orig-name-valid" />
|
|
|
|
<enum name = "priv-orig-name-charset" />
|
|
|
|
<enum name = "priv-orig-name-pres" />
|
|
|
|
<enum name = "priv-orig-num" />
|
|
|
|
<enum name = "priv-orig-num-valid" />
|
|
|
|
<enum name = "priv-orig-num-plan" />
|
|
|
|
<enum name = "priv-orig-num-pres" />
|
|
|
|
<enum name = "priv-orig-subaddr" />
|
|
|
|
<enum name = "priv-orig-subaddr-valid" />
|
|
|
|
<enum name = "priv-orig-subaddr-type" />
|
|
|
|
<enum name = "priv-orig-subaddr-odd" />
|
|
|
|
<enum name = "priv-orig-tag" />
|
|
|
|
<enum name = "priv-from-all" />
|
|
|
|
<enum name = "priv-from-name" />
|
|
|
|
<enum name = "priv-from-name-valid" />
|
|
|
|
<enum name = "priv-from-name-charset" />
|
|
|
|
<enum name = "priv-from-name-pres" />
|
|
|
|
<enum name = "priv-from-num" />
|
|
|
|
<enum name = "priv-from-num-valid" />
|
|
|
|
<enum name = "priv-from-num-plan" />
|
|
|
|
<enum name = "priv-from-num-pres" />
|
|
|
|
<enum name = "priv-from-subaddr" />
|
|
|
|
<enum name = "priv-from-subaddr-valid" />
|
|
|
|
<enum name = "priv-from-subaddr-type" />
|
|
|
|
<enum name = "priv-from-subaddr-odd" />
|
|
|
|
<enum name = "priv-from-tag" />
|
|
|
|
<enum name = "priv-to-all" />
|
|
|
|
<enum name = "priv-to-name" />
|
|
|
|
<enum name = "priv-to-name-valid" />
|
|
|
|
<enum name = "priv-to-name-charset" />
|
|
|
|
<enum name = "priv-to-name-pres" />
|
|
|
|
<enum name = "priv-to-num" />
|
|
|
|
<enum name = "priv-to-num-valid" />
|
|
|
|
<enum name = "priv-to-num-plan" />
|
|
|
|
<enum name = "priv-to-num-pres" />
|
|
|
|
<enum name = "priv-to-subaddr" />
|
|
|
|
<enum name = "priv-to-subaddr-valid" />
|
|
|
|
<enum name = "priv-to-subaddr-type" />
|
|
|
|
<enum name = "priv-to-subaddr-odd" />
|
|
|
|
<enum name = "priv-to-tag" />
|
2010-07-14 15:48:36 +00:00
|
|
|
<enum name = "reason" />
|
|
|
|
<enum name = "count" />
|
|
|
|
</enumlist>
|
|
|
|
</parameter>
|
|
|
|
<parameter name="i">
|
|
|
|
<para>If set, this will prevent the channel from sending out protocol
|
|
|
|
messages because of the value being set</para>
|
|
|
|
</parameter>
|
|
|
|
</syntax>
|
|
|
|
<description>
|
|
|
|
<para>Gets or sets Redirecting data on the channel.</para>
|
2015-11-06 13:54:59 +00:00
|
|
|
<para>The <replaceable>orig-pres</replaceable>,
|
|
|
|
<replaceable>from-pres</replaceable> and <replaceable>to-pres</replaceable>
|
|
|
|
fields get/set a combined value for the corresponding
|
|
|
|
<replaceable>...-name-pres</replaceable> and <replaceable>...-num-pres</replaceable>
|
|
|
|
fields.</para>
|
2016-03-01 00:11:33 +00:00
|
|
|
<para>The recognized values for the <replaceable>reason</replaceable>
|
2012-04-20 00:57:13 +00:00
|
|
|
and <replaceable>orig-reason</replaceable> fields are the following:</para>
|
2010-07-14 15:48:36 +00:00
|
|
|
<enumlist>
|
2016-03-01 00:11:33 +00:00
|
|
|
<enum name = "away"><para>Callee is Away</para></enum>
|
|
|
|
<enum name = "cf_dte"><para>Call Forwarding By The Called DTE</para></enum>
|
2010-07-14 15:48:36 +00:00
|
|
|
<enum name = "cfb"><para>Call Forwarding Busy</para></enum>
|
|
|
|
<enum name = "cfnr"><para>Call Forwarding No Reply</para></enum>
|
2016-03-01 00:11:33 +00:00
|
|
|
<enum name = "cfu"><para>Call Forwarding Unconditional</para></enum>
|
2010-07-14 15:48:36 +00:00
|
|
|
<enum name = "deflection"><para>Call Deflection</para></enum>
|
2016-03-01 00:11:33 +00:00
|
|
|
<enum name = "dnd"><para>Do Not Disturb</para></enum>
|
2010-07-14 15:48:36 +00:00
|
|
|
<enum name = "follow_me"><para>Follow Me</para></enum>
|
|
|
|
<enum name = "out_of_order"><para>Called DTE Out-Of-Order</para></enum>
|
2016-03-01 00:11:33 +00:00
|
|
|
<enum name = "send_to_vm"><para>Send the call to voicemail</para></enum>
|
|
|
|
<enum name = "time_of_day"><para>Time of Day</para></enum>
|
|
|
|
<enum name = "unavailable"><para>Callee is Unavailable</para></enum>
|
|
|
|
<enum name = "unknown"><para>Unknown</para></enum>
|
2010-07-14 15:48:36 +00:00
|
|
|
</enumlist>
|
2016-03-01 00:11:33 +00:00
|
|
|
<note><para>You can set a user defined reason string that SIP can
|
|
|
|
send/receive instead. The user defined reason string my need to be
|
|
|
|
quoted depending upon SIP or the peer's requirements. These strings
|
|
|
|
are treated as unknown by the non-SIP channel drivers.</para></note>
|
2010-07-14 15:48:36 +00:00
|
|
|
<para>The allowable values for the <replaceable>xxx-name-charset</replaceable>
|
|
|
|
field are the following:</para>
|
|
|
|
<enumlist>
|
|
|
|
<enum name = "unknown"><para>Unknown</para></enum>
|
|
|
|
<enum name = "iso8859-1"><para>ISO8859-1</para></enum>
|
|
|
|
<enum name = "withdrawn"><para>Withdrawn</para></enum>
|
|
|
|
<enum name = "iso8859-2"><para>ISO8859-2</para></enum>
|
|
|
|
<enum name = "iso8859-3"><para>ISO8859-3</para></enum>
|
|
|
|
<enum name = "iso8859-4"><para>ISO8859-4</para></enum>
|
|
|
|
<enum name = "iso8859-5"><para>ISO8859-5</para></enum>
|
|
|
|
<enum name = "iso8859-7"><para>ISO8859-7</para></enum>
|
|
|
|
<enum name = "bmp"><para>ISO10646 Bmp String</para></enum>
|
|
|
|
<enum name = "utf8"><para>ISO10646 UTF-8 String</para></enum>
|
|
|
|
</enumlist>
|
|
|
|
</description>
|
|
|
|
</function>
|
2008-11-01 21:10:07 +00:00
|
|
|
***/
|
|
|
|
|
2010-07-14 15:48:36 +00:00
|
|
|
enum ID_FIELD_STATUS {
|
|
|
|
ID_FIELD_VALID,
|
|
|
|
ID_FIELD_INVALID,
|
|
|
|
ID_FIELD_UNKNOWN
|
|
|
|
};
|
|
|
|
|
|
|
|
AST_DEFINE_APP_ARGS_TYPE(ast_party_func_args,
|
|
|
|
AST_APP_ARG(member); /*!< Member name */
|
|
|
|
AST_APP_ARG(opts); /*!< Options token */
|
|
|
|
AST_APP_ARG(other); /*!< Any remining unused arguments */
|
|
|
|
);
|
|
|
|
|
|
|
|
AST_DEFINE_APP_ARGS_TYPE(ast_party_members,
|
|
|
|
AST_APP_ARG(subnames[10]); /*!< Option member subnames */
|
|
|
|
);
|
|
|
|
|
|
|
|
enum CONNECTED_LINE_OPT_FLAGS {
|
|
|
|
CONNECTED_LINE_OPT_INHIBIT = (1 << 0),
|
|
|
|
};
|
|
|
|
enum CONNECTED_LINE_OPT_ARGS {
|
|
|
|
CONNECTED_LINE_OPT_DUMMY, /*!< Delete this if CONNECTED_LINE ever gets an option with parameters. */
|
|
|
|
|
|
|
|
/*! \note This entry _MUST_ be the last one in the enum */
|
|
|
|
CONNECTED_LINE_OPT_ARG_ARRAY_SIZE
|
|
|
|
};
|
|
|
|
|
|
|
|
AST_APP_OPTIONS(connectedline_opts, BEGIN_OPTIONS
|
|
|
|
AST_APP_OPTION('i', CONNECTED_LINE_OPT_INHIBIT),
|
|
|
|
END_OPTIONS);
|
|
|
|
|
|
|
|
enum REDIRECTING_OPT_FLAGS {
|
|
|
|
REDIRECTING_OPT_INHIBIT = (1 << 0),
|
|
|
|
};
|
|
|
|
enum REDIRECTING_OPT_ARGS {
|
|
|
|
REDIRECTING_OPT_DUMMY, /*!< Delete this if REDIRECTING ever gets an option with parameters. */
|
|
|
|
|
|
|
|
/*! \note This entry _MUST_ be the last one in the enum */
|
|
|
|
REDIRECTING_OPT_ARG_ARRAY_SIZE
|
|
|
|
};
|
|
|
|
|
|
|
|
AST_APP_OPTIONS(redirecting_opts, BEGIN_OPTIONS
|
|
|
|
AST_APP_OPTION('i', REDIRECTING_OPT_INHIBIT),
|
|
|
|
END_OPTIONS);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Read values from the party name struct.
|
|
|
|
* \since 1.8
|
|
|
|
*
|
|
|
|
* \param buf Buffer to fill with read value.
|
|
|
|
* \param len Length of the buffer.
|
|
|
|
* \param argc Number of party member subnames.
|
|
|
|
* \param argv Party member subnames given.
|
|
|
|
* \param name Party name to get values from.
|
|
|
|
*
|
|
|
|
* \retval ID_FIELD_VALID on success.
|
|
|
|
* \retval ID_FIELD_UNKNOWN on unknown field name.
|
|
|
|
*/
|
|
|
|
static enum ID_FIELD_STATUS party_name_read(char *buf, size_t len, int argc, char *argv[], const struct ast_party_name *name)
|
|
|
|
{
|
|
|
|
enum ID_FIELD_STATUS status;
|
|
|
|
|
|
|
|
status = ID_FIELD_VALID;
|
|
|
|
|
|
|
|
if (argc == 0) {
|
|
|
|
/* We want the name string */
|
|
|
|
if (name->valid && name->str) {
|
|
|
|
ast_copy_string(buf, name->str, len);
|
|
|
|
}
|
|
|
|
} else if (argc == 1 && !strcasecmp("valid", argv[0])) {
|
|
|
|
snprintf(buf, len, "%d", name->valid);
|
|
|
|
} else if (argc == 1 && !strcasecmp("charset", argv[0])) {
|
|
|
|
ast_copy_string(buf, ast_party_name_charset_str(name->char_set), len);
|
|
|
|
} else if (argc == 1 && !strncasecmp("pres", argv[0], 4)) {
|
|
|
|
/* Accept pres[entation] */
|
|
|
|
ast_copy_string(buf, ast_named_caller_presentation(name->presentation), len);
|
|
|
|
} else {
|
|
|
|
status = ID_FIELD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Read values from the party number struct.
|
|
|
|
* \since 1.8
|
|
|
|
*
|
|
|
|
* \param buf Buffer to fill with read value.
|
|
|
|
* \param len Length of the buffer.
|
|
|
|
* \param argc Number of party member subnames.
|
|
|
|
* \param argv Party member subnames given.
|
|
|
|
* \param number Party number to get values from.
|
|
|
|
*
|
|
|
|
* \retval ID_FIELD_VALID on success.
|
|
|
|
* \retval ID_FIELD_UNKNOWN on unknown field name.
|
|
|
|
*/
|
|
|
|
static enum ID_FIELD_STATUS party_number_read(char *buf, size_t len, int argc, char *argv[], const struct ast_party_number *number)
|
|
|
|
{
|
|
|
|
enum ID_FIELD_STATUS status;
|
|
|
|
|
|
|
|
status = ID_FIELD_VALID;
|
|
|
|
|
|
|
|
if (argc == 0) {
|
|
|
|
/* We want the number string */
|
|
|
|
if (number->valid && number->str) {
|
|
|
|
ast_copy_string(buf, number->str, len);
|
|
|
|
}
|
|
|
|
} else if (argc == 1 && !strcasecmp("valid", argv[0])) {
|
|
|
|
snprintf(buf, len, "%d", number->valid);
|
|
|
|
} else if (argc == 1 && !strcasecmp("plan", argv[0])) {
|
|
|
|
snprintf(buf, len, "%d", number->plan);
|
|
|
|
} else if (argc == 1 && !strncasecmp("pres", argv[0], 4)) {
|
|
|
|
/* Accept pres[entation] */
|
|
|
|
ast_copy_string(buf, ast_named_caller_presentation(number->presentation), len);
|
|
|
|
} else {
|
|
|
|
status = ID_FIELD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Read values from the party subaddress struct.
|
|
|
|
* \since 1.8
|
|
|
|
*
|
|
|
|
* \param buf Buffer to fill with read value.
|
|
|
|
* \param len Length of the buffer.
|
|
|
|
* \param argc Number of party member subnames.
|
|
|
|
* \param argv Party member subnames given.
|
|
|
|
* \param subaddress Party subaddress to get values from.
|
|
|
|
*
|
|
|
|
* \retval ID_FIELD_VALID on success.
|
|
|
|
* \retval ID_FIELD_UNKNOWN on unknown field name.
|
|
|
|
*/
|
|
|
|
static enum ID_FIELD_STATUS party_subaddress_read(char *buf, size_t len, int argc, char *argv[], const struct ast_party_subaddress *subaddress)
|
|
|
|
{
|
|
|
|
enum ID_FIELD_STATUS status;
|
|
|
|
|
|
|
|
status = ID_FIELD_VALID;
|
|
|
|
|
|
|
|
if (argc == 0) {
|
|
|
|
/* We want the subaddress string */
|
|
|
|
if (subaddress->str) {
|
|
|
|
ast_copy_string(buf, subaddress->str, len);
|
|
|
|
}
|
|
|
|
} else if (argc == 1 && !strcasecmp("valid", argv[0])) {
|
|
|
|
snprintf(buf, len, "%d", subaddress->valid);
|
|
|
|
} else if (argc == 1 && !strcasecmp("type", argv[0])) {
|
|
|
|
snprintf(buf, len, "%d", subaddress->type);
|
|
|
|
} else if (argc == 1 && !strcasecmp("odd", argv[0])) {
|
|
|
|
snprintf(buf, len, "%d", subaddress->odd_even_indicator);
|
|
|
|
} else {
|
|
|
|
status = ID_FIELD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Read values from the party id struct.
|
|
|
|
* \since 1.8
|
|
|
|
*
|
|
|
|
* \param buf Buffer to fill with read value.
|
|
|
|
* \param len Length of the buffer.
|
|
|
|
* \param argc Number of party member subnames.
|
|
|
|
* \param argv Party member subnames given.
|
|
|
|
* \param id Party id to get values from.
|
|
|
|
*
|
|
|
|
* \retval ID_FIELD_VALID on success.
|
|
|
|
* \retval ID_FIELD_UNKNOWN on unknown field name.
|
|
|
|
*/
|
|
|
|
static enum ID_FIELD_STATUS party_id_read(char *buf, size_t len, int argc, char *argv[], const struct ast_party_id *id)
|
|
|
|
{
|
|
|
|
enum ID_FIELD_STATUS status;
|
|
|
|
|
|
|
|
if (argc == 0) {
|
|
|
|
/* Must have at least one subname. */
|
|
|
|
return ID_FIELD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
status = ID_FIELD_VALID;
|
|
|
|
|
|
|
|
if (argc == 1 && !strcasecmp("all", argv[0])) {
|
|
|
|
snprintf(buf, len, "\"%s\" <%s>",
|
|
|
|
S_COR(id->name.valid, id->name.str, ""),
|
|
|
|
S_COR(id->number.valid, id->number.str, ""));
|
|
|
|
} else if (!strcasecmp("name", argv[0])) {
|
|
|
|
status = party_name_read(buf, len, argc - 1, argv + 1, &id->name);
|
|
|
|
} else if (!strncasecmp("num", argv[0], 3)) {
|
|
|
|
/* Accept num[ber] */
|
|
|
|
status = party_number_read(buf, len, argc - 1, argv + 1, &id->number);
|
|
|
|
} else if (!strncasecmp("subaddr", argv[0], 7)) {
|
|
|
|
/* Accept subaddr[ess] */
|
|
|
|
status = party_subaddress_read(buf, len, argc - 1, argv + 1, &id->subaddress);
|
|
|
|
} else if (argc == 1 && !strcasecmp("tag", argv[0])) {
|
|
|
|
if (id->tag) {
|
|
|
|
ast_copy_string(buf, id->tag, len);
|
|
|
|
}
|
|
|
|
} else if (argc == 1 && !strcasecmp("ton", argv[0])) {
|
|
|
|
/* ton is an alias for num-plan */
|
|
|
|
snprintf(buf, len, "%d", id->number.plan);
|
|
|
|
} else if (argc == 1 && !strncasecmp("pres", argv[0], 4)) {
|
|
|
|
/*
|
|
|
|
* Accept pres[entation]
|
|
|
|
* This is the combined name/number presentation.
|
|
|
|
*/
|
|
|
|
ast_copy_string(buf,
|
|
|
|
ast_named_caller_presentation(ast_party_id_presentation(id)), len);
|
|
|
|
} else {
|
|
|
|
status = ID_FIELD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Write new values to the party name struct
|
|
|
|
* \since 1.8
|
|
|
|
*
|
|
|
|
* \param name Party name struct to write values
|
|
|
|
* \param argc Number of party member subnames.
|
|
|
|
* \param argv Party member subnames given.
|
|
|
|
* \param value Value to assign to the party name.
|
|
|
|
*
|
|
|
|
* \retval ID_FIELD_VALID on success.
|
|
|
|
* \retval ID_FIELD_INVALID on error with field value.
|
|
|
|
* \retval ID_FIELD_UNKNOWN on unknown field name.
|
|
|
|
*/
|
|
|
|
static enum ID_FIELD_STATUS party_name_write(struct ast_party_name *name, int argc, char *argv[], const char *value)
|
|
|
|
{
|
|
|
|
char *val;
|
|
|
|
enum ID_FIELD_STATUS status;
|
|
|
|
|
|
|
|
status = ID_FIELD_VALID;
|
|
|
|
|
|
|
|
if (argc == 0) {
|
|
|
|
/* We are setting the name string */
|
|
|
|
name->valid = 1;
|
|
|
|
name->str = ast_strdup(value);
|
|
|
|
ast_trim_blanks(name->str);
|
|
|
|
} else if (argc == 1 && !strcasecmp("valid", argv[0])) {
|
|
|
|
name->valid = atoi(value) ? 1 : 0;
|
|
|
|
} else if (argc == 1 && !strcasecmp("charset", argv[0])) {
|
|
|
|
int char_set;
|
|
|
|
|
|
|
|
val = ast_strdupa(value);
|
|
|
|
ast_trim_blanks(val);
|
|
|
|
|
|
|
|
if (('0' <= val[0]) && (val[0] <= '9')) {
|
|
|
|
char_set = atoi(val);
|
|
|
|
} else {
|
|
|
|
char_set = ast_party_name_charset_parse(val);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (char_set < 0) {
|
|
|
|
ast_log(LOG_ERROR,
|
|
|
|
"Unknown name char-set '%s', value unchanged\n", val);
|
|
|
|
status = ID_FIELD_INVALID;
|
|
|
|
} else {
|
|
|
|
name->char_set = char_set;
|
|
|
|
}
|
|
|
|
} else if (argc == 1 && !strncasecmp("pres", argv[0], 4)) {
|
|
|
|
int pres;
|
|
|
|
|
|
|
|
/* Accept pres[entation] */
|
|
|
|
val = ast_strdupa(value);
|
|
|
|
ast_trim_blanks(val);
|
|
|
|
|
|
|
|
if (('0' <= val[0]) && (val[0] <= '9')) {
|
|
|
|
pres = atoi(val);
|
|
|
|
} else {
|
|
|
|
pres = ast_parse_caller_presentation(val);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pres < 0) {
|
|
|
|
ast_log(LOG_ERROR,
|
|
|
|
"Unknown name presentation '%s', value unchanged\n", val);
|
|
|
|
status = ID_FIELD_INVALID;
|
|
|
|
} else {
|
|
|
|
name->presentation = pres;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
status = ID_FIELD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Write new values to the party number struct
|
|
|
|
* \since 1.8
|
|
|
|
*
|
|
|
|
* \param number Party number struct to write values
|
|
|
|
* \param argc Number of party member subnames.
|
|
|
|
* \param argv Party member subnames given.
|
|
|
|
* \param value Value to assign to the party number.
|
|
|
|
*
|
|
|
|
* \retval ID_FIELD_VALID on success.
|
|
|
|
* \retval ID_FIELD_INVALID on error with field value.
|
|
|
|
* \retval ID_FIELD_UNKNOWN on unknown field name.
|
|
|
|
*/
|
|
|
|
static enum ID_FIELD_STATUS party_number_write(struct ast_party_number *number, int argc, char *argv[], const char *value)
|
|
|
|
{
|
|
|
|
char *val;
|
|
|
|
enum ID_FIELD_STATUS status;
|
|
|
|
|
|
|
|
status = ID_FIELD_VALID;
|
|
|
|
|
|
|
|
if (argc == 0) {
|
|
|
|
/* We are setting the number string */
|
|
|
|
number->valid = 1;
|
|
|
|
number->str = ast_strdup(value);
|
|
|
|
ast_trim_blanks(number->str);
|
|
|
|
} else if (argc == 1 && !strcasecmp("valid", argv[0])) {
|
|
|
|
number->valid = atoi(value) ? 1 : 0;
|
|
|
|
} else if (argc == 1 && !strcasecmp("plan", argv[0])) {
|
|
|
|
val = ast_strdupa(value);
|
|
|
|
ast_trim_blanks(val);
|
|
|
|
|
|
|
|
if (('0' <= val[0]) && (val[0] <= '9')) {
|
|
|
|
number->plan = atoi(val);
|
|
|
|
} else {
|
|
|
|
ast_log(LOG_ERROR,
|
|
|
|
"Unknown type-of-number/numbering-plan '%s', value unchanged\n", val);
|
|
|
|
status = ID_FIELD_INVALID;
|
|
|
|
}
|
|
|
|
} else if (argc == 1 && !strncasecmp("pres", argv[0], 4)) {
|
|
|
|
int pres;
|
|
|
|
|
|
|
|
/* Accept pres[entation] */
|
|
|
|
val = ast_strdupa(value);
|
|
|
|
ast_trim_blanks(val);
|
|
|
|
|
|
|
|
if (('0' <= val[0]) && (val[0] <= '9')) {
|
|
|
|
pres = atoi(val);
|
|
|
|
} else {
|
|
|
|
pres = ast_parse_caller_presentation(val);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pres < 0) {
|
|
|
|
ast_log(LOG_ERROR,
|
|
|
|
"Unknown number presentation '%s', value unchanged\n", val);
|
|
|
|
status = ID_FIELD_INVALID;
|
|
|
|
} else {
|
|
|
|
number->presentation = pres;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
status = ID_FIELD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Write new values to the party subaddress struct
|
|
|
|
* \since 1.8
|
|
|
|
*
|
|
|
|
* \param subaddress Party subaddress struct to write values
|
|
|
|
* \param argc Number of party member subnames.
|
|
|
|
* \param argv Party member subnames given.
|
|
|
|
* \param value Value to assign to the party subaddress.
|
|
|
|
*
|
|
|
|
* \retval ID_FIELD_VALID on success.
|
|
|
|
* \retval ID_FIELD_INVALID on error with field value.
|
|
|
|
* \retval ID_FIELD_UNKNOWN on unknown field name.
|
|
|
|
*/
|
|
|
|
static enum ID_FIELD_STATUS party_subaddress_write(struct ast_party_subaddress *subaddress, int argc, char *argv[], const char *value)
|
|
|
|
{
|
|
|
|
enum ID_FIELD_STATUS status;
|
|
|
|
|
|
|
|
status = ID_FIELD_VALID;
|
|
|
|
|
|
|
|
if (argc == 0) {
|
|
|
|
/* We are setting the subaddress string */
|
|
|
|
subaddress->str = ast_strdup(value);
|
|
|
|
ast_trim_blanks(subaddress->str);
|
|
|
|
} else if (argc == 1 && !strcasecmp("valid", argv[0])) {
|
|
|
|
subaddress->valid = atoi(value) ? 1 : 0;
|
|
|
|
} else if (argc == 1 && !strcasecmp("type", argv[0])) {
|
|
|
|
subaddress->type = atoi(value) ? 2 : 0;
|
|
|
|
} else if (argc == 1 && !strcasecmp("odd", argv[0])) {
|
|
|
|
subaddress->odd_even_indicator = atoi(value) ? 1 : 0;
|
|
|
|
} else {
|
|
|
|
status = ID_FIELD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Write new values to the party id struct
|
|
|
|
* \since 1.8
|
|
|
|
*
|
|
|
|
* \param id Party ID struct to write values
|
|
|
|
* \param argc Number of party member subnames.
|
|
|
|
* \param argv Party member subnames given.
|
|
|
|
* \param value Value to assign to the party id.
|
|
|
|
*
|
|
|
|
* \retval ID_FIELD_VALID on success.
|
|
|
|
* \retval ID_FIELD_INVALID on error with field value.
|
|
|
|
* \retval ID_FIELD_UNKNOWN on unknown field name.
|
|
|
|
*/
|
|
|
|
static enum ID_FIELD_STATUS party_id_write(struct ast_party_id *id, int argc, char *argv[], const char *value)
|
|
|
|
{
|
|
|
|
char *val;
|
|
|
|
enum ID_FIELD_STATUS status;
|
|
|
|
|
|
|
|
if (argc == 0) {
|
|
|
|
/* Must have at least one subname. */
|
|
|
|
return ID_FIELD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
status = ID_FIELD_VALID;
|
|
|
|
|
|
|
|
if (argc == 1 && !strcasecmp("all", argv[0])) {
|
|
|
|
char name[256];
|
|
|
|
char num[256];
|
|
|
|
|
|
|
|
ast_callerid_split(value, name, sizeof(name), num, sizeof(num));
|
|
|
|
id->name.valid = 1;
|
|
|
|
id->name.str = ast_strdup(name);
|
|
|
|
if (!id->name.str) {
|
|
|
|
return ID_FIELD_INVALID;
|
|
|
|
}
|
|
|
|
id->number.valid = 1;
|
|
|
|
id->number.str = ast_strdup(num);
|
|
|
|
if (!id->number.str) {
|
|
|
|
return ID_FIELD_INVALID;
|
|
|
|
}
|
|
|
|
} else if (!strcasecmp("name", argv[0])) {
|
|
|
|
status = party_name_write(&id->name, argc - 1, argv + 1, value);
|
|
|
|
} else if (!strncasecmp("num", argv[0], 3)) {
|
|
|
|
/* Accept num[ber] */
|
|
|
|
status = party_number_write(&id->number, argc - 1, argv + 1, value);
|
|
|
|
} else if (!strncasecmp("subaddr", argv[0], 7)) {
|
|
|
|
/* Accept subaddr[ess] */
|
|
|
|
status = party_subaddress_write(&id->subaddress, argc - 1, argv + 1, value);
|
|
|
|
} else if (argc == 1 && !strcasecmp("tag", argv[0])) {
|
|
|
|
id->tag = ast_strdup(value);
|
|
|
|
ast_trim_blanks(id->tag);
|
|
|
|
} else if (argc == 1 && !strcasecmp("ton", argv[0])) {
|
|
|
|
/* ton is an alias for num-plan */
|
|
|
|
argv[0] = "plan";
|
|
|
|
status = party_number_write(&id->number, argc, argv, value);
|
|
|
|
} else if (argc == 1 && !strncasecmp("pres", argv[0], 4)) {
|
|
|
|
int pres;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Accept pres[entation]
|
|
|
|
* This is the combined name/number presentation.
|
|
|
|
*/
|
|
|
|
val = ast_strdupa(value);
|
|
|
|
ast_trim_blanks(val);
|
|
|
|
|
|
|
|
if (('0' <= val[0]) && (val[0] <= '9')) {
|
|
|
|
pres = atoi(val);
|
|
|
|
} else {
|
|
|
|
pres = ast_parse_caller_presentation(val);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pres < 0) {
|
|
|
|
ast_log(LOG_ERROR,
|
|
|
|
"Unknown combined presentation '%s', value unchanged\n", val);
|
|
|
|
status = ID_FIELD_INVALID;
|
|
|
|
} else {
|
|
|
|
id->name.presentation = pres;
|
|
|
|
id->number.presentation = pres;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
status = ID_FIELD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*! TRUE if we have already notified about CALLERPRES being deprecated. */
|
|
|
|
static int callerpres_deprecate_notify;
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Read values from the caller-id presentation information struct.
|
|
|
|
*
|
|
|
|
* \param chan Asterisk channel to read
|
|
|
|
* \param cmd Not used
|
|
|
|
* \param data Caller-id presentation function datatype string
|
|
|
|
* \param buf Buffer to fill with read value.
|
|
|
|
* \param len Length of the buffer
|
|
|
|
*
|
|
|
|
* \retval 0 on success.
|
|
|
|
* \retval -1 on error.
|
|
|
|
*/
|
2007-02-03 22:05:02 +00:00
|
|
|
static int callerpres_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
|
|
|
|
{
|
2014-03-27 19:21:44 +00:00
|
|
|
if (!chan) {
|
|
|
|
ast_log(LOG_WARNING, "No channel was provided to %s function.\n", cmd);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2010-07-14 15:48:36 +00:00
|
|
|
if (!callerpres_deprecate_notify) {
|
|
|
|
callerpres_deprecate_notify = 1;
|
|
|
|
ast_log(LOG_WARNING, "CALLERPRES is deprecated."
|
|
|
|
" Use CALLERID(name-pres) or CALLERID(num-pres) instead.\n");
|
|
|
|
}
|
|
|
|
ast_copy_string(buf,
|
2012-02-29 16:52:47 +00:00
|
|
|
ast_named_caller_presentation(ast_party_id_presentation(&ast_channel_caller(chan)->id)), len);
|
2007-02-03 22:05:02 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-07-14 15:48:36 +00:00
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Write new values to the caller-id presentation information struct.
|
|
|
|
*
|
|
|
|
* \param chan Asterisk channel to update
|
|
|
|
* \param cmd Not used
|
|
|
|
* \param data Caller-id presentation function datatype string
|
|
|
|
* \param value Value to assign to the caller-id presentation information struct.
|
|
|
|
*
|
|
|
|
* \retval 0 on success.
|
|
|
|
* \retval -1 on error.
|
|
|
|
*/
|
2007-02-03 22:05:02 +00:00
|
|
|
static int callerpres_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
|
|
|
|
{
|
2010-07-14 15:48:36 +00:00
|
|
|
int pres;
|
|
|
|
|
2014-03-27 19:21:44 +00:00
|
|
|
if (!chan) {
|
|
|
|
ast_log(LOG_WARNING, "No channel was provided to %s function.\n", cmd);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2010-07-14 15:48:36 +00:00
|
|
|
if (!callerpres_deprecate_notify) {
|
|
|
|
callerpres_deprecate_notify = 1;
|
|
|
|
ast_log(LOG_WARNING, "CALLERPRES is deprecated."
|
|
|
|
" Use CALLERID(name-pres) or CALLERID(num-pres) instead.\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
pres = ast_parse_caller_presentation(value);
|
|
|
|
if (pres < 0) {
|
2007-02-03 22:05:02 +00:00
|
|
|
ast_log(LOG_WARNING, "'%s' is not a valid presentation (see 'show function CALLERPRES')\n", value);
|
2010-07-14 15:48:36 +00:00
|
|
|
} else {
|
2012-02-29 16:52:47 +00:00
|
|
|
ast_channel_caller(chan)->id.name.presentation = pres;
|
|
|
|
ast_channel_caller(chan)->id.number.presentation = pres;
|
2010-07-14 15:48:36 +00:00
|
|
|
}
|
2007-02-03 22:05:02 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-07-14 15:48:36 +00:00
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Read values from the caller-id information struct.
|
|
|
|
*
|
|
|
|
* \param chan Asterisk channel to read
|
|
|
|
* \param cmd Not used
|
|
|
|
* \param data Caller-id function datatype string
|
|
|
|
* \param buf Buffer to fill with read value.
|
|
|
|
* \param len Length of the buffer
|
|
|
|
*
|
|
|
|
* \retval 0 on success.
|
|
|
|
* \retval -1 on error.
|
|
|
|
*/
|
|
|
|
static int callerid_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
|
2005-05-15 17:45:30 +00:00
|
|
|
{
|
2010-07-14 15:48:36 +00:00
|
|
|
char *parms;
|
2017-12-19 01:19:34 +00:00
|
|
|
struct ast_party_members member = { 0, };
|
2010-07-14 15:48:36 +00:00
|
|
|
AST_DECLARE_APP_ARGS(args,
|
|
|
|
AST_APP_ARG(member); /*!< Member name */
|
|
|
|
AST_APP_ARG(cid); /*!< Optional caller id to parse instead of from the channel. */
|
|
|
|
);
|
2005-12-23 21:03:25 +00:00
|
|
|
|
2008-10-07 02:02:39 +00:00
|
|
|
/* Ensure that the buffer is empty */
|
|
|
|
*buf = 0;
|
|
|
|
|
2010-07-14 15:48:36 +00:00
|
|
|
if (!chan) {
|
2007-04-19 02:51:21 +00:00
|
|
|
return -1;
|
2010-07-14 15:48:36 +00:00
|
|
|
}
|
2007-04-19 02:51:21 +00:00
|
|
|
|
2010-07-14 15:48:36 +00:00
|
|
|
parms = ast_strdupa(data);
|
|
|
|
AST_STANDARD_APP_ARGS(args, parms);
|
|
|
|
if (args.argc == 0) {
|
|
|
|
/* Must have at least one argument. */
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
AST_NONSTANDARD_APP_ARGS(member, args.member, '-');
|
|
|
|
if (member.argc == 0 || ARRAY_LEN(member.subnames) <= member.argc) {
|
|
|
|
/* Too few or too many subnames */
|
|
|
|
return -1;
|
|
|
|
}
|
2005-12-23 21:03:25 +00:00
|
|
|
|
2010-07-14 15:48:36 +00:00
|
|
|
if (args.argc == 2) {
|
|
|
|
char name[80];
|
|
|
|
char num[80];
|
2005-12-23 21:03:25 +00:00
|
|
|
|
2010-07-14 15:48:36 +00:00
|
|
|
ast_callerid_split(args.cid, name, sizeof(name), num, sizeof(num));
|
|
|
|
|
|
|
|
if (member.argc == 1 && !strcasecmp("all", member.argv[0])) {
|
2006-02-12 04:28:58 +00:00
|
|
|
snprintf(buf, len, "\"%s\" <%s>", name, num);
|
2010-07-14 15:48:36 +00:00
|
|
|
} else if (member.argc == 1 && !strcasecmp("name", member.argv[0])) {
|
2005-12-23 21:03:25 +00:00
|
|
|
ast_copy_string(buf, name, len);
|
2010-07-14 15:48:36 +00:00
|
|
|
} else if (member.argc == 1 && !strncasecmp("num", member.argv[0], 3)) {
|
|
|
|
/* Accept num[ber] */
|
2005-12-23 21:03:25 +00:00
|
|
|
ast_copy_string(buf, num, len);
|
|
|
|
} else {
|
2006-09-19 21:07:49 +00:00
|
|
|
ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
|
2005-05-15 17:45:30 +00:00
|
|
|
}
|
|
|
|
} else {
|
2012-04-17 18:57:40 +00:00
|
|
|
enum ID_FIELD_STATUS status;
|
2007-11-29 00:28:10 +00:00
|
|
|
ast_channel_lock(chan);
|
|
|
|
|
2010-07-14 15:48:36 +00:00
|
|
|
if (member.argc == 1 && !strcasecmp("rdnis", member.argv[0])) {
|
2012-02-29 16:52:47 +00:00
|
|
|
if (ast_channel_redirecting(chan)->from.number.valid
|
|
|
|
&& ast_channel_redirecting(chan)->from.number.str) {
|
|
|
|
ast_copy_string(buf, ast_channel_redirecting(chan)->from.number.str, len);
|
Enhancements to connected line and redirecting work.
From reviewboard:
Digium has a commercial customer who has made extensive use of the connected party and
redirecting information present in later versions of Asterisk Business Edition and which
is to be in the upcoming 1.8 release. Through their use of the feature, new problems and solutions
have come about. This patch adds several enhancements to maximize usage of the connected party
and redirecting information functionality.
First, Asterisk trunk already had connected line interception macros. These macros allow you to
manipulate connected line information before it was sent out to its target. This patch adds the
same feature except for redirecting information instead.
Second, the ast_callerid and ast_party_id structures have been enhanced to provide a "tag." This
tag can be set with func_callerid, func_connectedline, func_redirecting, and in the case of DAHDI,
mISDN, and SIP channels, can be set in a configuration file. The idea behind the callerid tag is
that it can be set to whatever value the administrator likes. Later, when running connected line
and redirecting macros, the admin can read the tag off the appropriate structure to determine what
action to take. You can think of this sort of like a channel variable, except that instead of having
the variable associated with a channel, the variable is associated with a specific identity within
Asterisk.
Third, app_dial has two new options, s and u. The s option lets a dialplan writer force a specific
caller ID tag to be placed on the outgoing channel. The u option allows the dialplan writer to force
a specific calling presentation value on the outgoing channel.
Fourth, there is a new control frame subclass called AST_CONTROL_READ_ACTION added. This was added
to correct a very specific situation. In the case of SIP semi-attended (blond) transfers, the party
being transferred would not have the opportunity to run a connected line interception macro to
possibly alter the transfer target's connected line information. The issue here was that during a
blond transfer, the SIP transfer code has no bridged channel on which to queue the connected line
update. The way this was corrected was to add this new control frame subclass. Now, we queue an
AST_CONTROL_READ_ACTION frame on the channel on which the connected line interception macro should
be run. When ast_read is called to read the frame, ast_read responds by calling a callback function
associated with the specific read action the control frame describes. In this case, the action taken
is to run the connected line interception macro on the transferee's channel.
Review: https://reviewboard.asterisk.org/r/652/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@263541 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-17 15:36:31 +00:00
|
|
|
}
|
2010-07-14 15:48:36 +00:00
|
|
|
} else if (!strcasecmp("dnid", member.argv[0])) {
|
|
|
|
if (member.argc == 1) {
|
|
|
|
/* Setup as if user had given dnid-num instead. */
|
|
|
|
member.argc = 2;
|
|
|
|
member.argv[1] = "num";
|
2005-12-23 21:03:25 +00:00
|
|
|
}
|
2010-07-14 15:48:36 +00:00
|
|
|
if (!strncasecmp("num", member.argv[1], 3)) {
|
|
|
|
/*
|
|
|
|
* Accept num[ber]
|
|
|
|
* dnid-num...
|
|
|
|
*/
|
|
|
|
if (member.argc == 2) {
|
|
|
|
/* dnid-num */
|
2012-02-29 16:52:47 +00:00
|
|
|
if (ast_channel_dialed(chan)->number.str) {
|
|
|
|
ast_copy_string(buf, ast_channel_dialed(chan)->number.str, len);
|
2009-10-22 16:33:22 +00:00
|
|
|
}
|
2010-07-14 15:48:36 +00:00
|
|
|
} else if (member.argc == 3 && !strcasecmp("plan", member.argv[2])) {
|
|
|
|
/* dnid-num-plan */
|
2012-02-29 16:52:47 +00:00
|
|
|
snprintf(buf, len, "%d", ast_channel_dialed(chan)->number.plan);
|
2010-07-14 15:48:36 +00:00
|
|
|
} else {
|
|
|
|
ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
|
2009-10-22 16:33:22 +00:00
|
|
|
}
|
2010-07-14 15:48:36 +00:00
|
|
|
} else if (!strncasecmp("subaddr", member.argv[1], 7)) {
|
|
|
|
/*
|
|
|
|
* Accept subaddr[ess]
|
|
|
|
* dnid-subaddr...
|
|
|
|
*/
|
|
|
|
status = party_subaddress_read(buf, len, member.argc - 2, member.argv + 2,
|
2012-02-29 16:52:47 +00:00
|
|
|
&ast_channel_dialed(chan)->subaddress);
|
2010-07-14 15:48:36 +00:00
|
|
|
switch (status) {
|
|
|
|
case ID_FIELD_VALID:
|
|
|
|
case ID_FIELD_INVALID:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
|
|
|
|
break;
|
2009-10-22 16:33:22 +00:00
|
|
|
}
|
2010-07-14 15:48:36 +00:00
|
|
|
} else {
|
|
|
|
ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
|
2009-10-22 16:33:22 +00:00
|
|
|
}
|
2010-07-14 15:48:36 +00:00
|
|
|
} else if (member.argc == 1 && !strcasecmp("ani2", member.argv[0])) {
|
2012-02-29 16:52:47 +00:00
|
|
|
snprintf(buf, len, "%d", ast_channel_caller(chan)->ani2);
|
2010-07-14 16:58:03 +00:00
|
|
|
} else if (!strcasecmp("ani", member.argv[0])) {
|
|
|
|
if (member.argc == 1) {
|
|
|
|
/* Setup as if user had given ani-num instead. */
|
|
|
|
member.argc = 2;
|
|
|
|
member.argv[1] = "num";
|
|
|
|
}
|
|
|
|
status = party_id_read(buf, len, member.argc - 1, member.argv + 1,
|
2012-02-29 16:52:47 +00:00
|
|
|
&ast_channel_caller(chan)->ani);
|
2010-07-14 16:58:03 +00:00
|
|
|
switch (status) {
|
|
|
|
case ID_FIELD_VALID:
|
|
|
|
case ID_FIELD_INVALID:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
|
|
|
|
break;
|
2005-12-23 21:03:25 +00:00
|
|
|
}
|
Add private representation of caller, connected and redirecting party ids.
This patch adds the feature "Private representation of caller, connected
and redirecting party ids", as previously discussed with us (DATUS) and
Digium.
1. Feature motivation
Until now it is quite difficult to modify a party number or name which can
only be seen by exactly one particular instantiated technology channel
subscriber. One example where a modified party number or name on one
channel is spread over several channels are supplementary services like
call transfer or pickup. To implement these features Asterisk internally
copies caller and connected ids from one channel to another. Another
example are extension subscriptions. The monitoring entities (watchers)
are notified of state changes and - if desired - of party numbers or names
which represent the involving call parties. One major feature where a
private representation of party names is essentially needed, i.e. where a
party name shall be exclusively signaled to only one particular user, is a
private user-specific name resolution for party numbers. A lookup in a
private destination-dependent telephone book shall provide party names
which cannot be seen by any other user at any time.
2. Feature Description
This feature comes along with the implementation of additional private
party id elements for caller id, connected id and redirecting ids inside
Asterisk channels.
The private party id elements can be read or set by the user using
Asterisk dialplan functions.
When a technology channel is initiating a call, receives an internal
connected-line update event, or receives an internal redirecting update
event, it merges the corresponding public id with the private id to create
an effective party id. The effective party id is then used for protocol
signaling.
The channel technologies which initially support the private id
representation with this patch are SIP (chan_sip), mISDN (chan_misdn) and
PRI (chan_dahdi).
Once a private name or number on a channel is set and (implicitly) made
valid, it is generally used for any further protocol signaling until it is
rewritten or invalidated.
To simplify the invalidation of private ids all internally generated
connected/redirecting update events and also all connected/redirecting
update events which are generated by technology channels -- receiving
regarding protocol information - automatically trigger the invalidation of
private ids.
If not using the private party id representation feature at all, i.e. if
using only the 'regular' caller-id, connected and redirecting related
functions, the current characteristic of Asterisk is not affected by the
new extended functionality.
3. User interface Description
To grant access to the private name and number representation from the
Asterisk dialplan, the CALLERID, CONNECTEDLINE and REDIRECTING dialplan
functions are extended by the following data types. The formats of these
data types are equal to the corresponding regular 'non-private' already
existing data types:
CALLERID:
priv-all
priv-name priv-name-valid priv-name-charset priv-name-pres
priv-num priv-num-valid priv-num-plan priv-num-pres
priv-subaddr priv-subaddr-valid priv-subaddr-type priv-subaddr-odd
priv-tag
CONNECTEDLINE:
priv-name priv-name-valid priv-name-pres priv-name-charset
priv-num priv-num-valid priv-num-pres priv-num-plan
priv-subaddr priv-subaddr-valid priv-subaddr-type priv-subaddr-odd
priv-tag
REDIRECTING:
priv-orig-name priv-orig-name-valid priv-orig-name-pres priv-orig-name-charset
priv-orig-num priv-orig-num-valid priv-orig-num-pres priv-orig-num-plan
priv-orig-subaddr priv-orig-subaddr-valid priv-orig-subaddr-type priv-orig-subaddr-odd
priv-orig-tag
priv-from-name priv-from-name-valid priv-from-name-pres priv-from-name-charset
priv-from-num priv-from-num-valid priv-from-num-pres priv-from-num-plan
priv-from-subaddr priv-from-subaddr-valid priv-from-subaddr-type priv-from-subaddr-odd
priv-from-tag
priv-to-name priv-to-name-valid priv-to-name-pres priv-to-name-charset
priv-to-num priv-to-num-valid priv-to-num-pres priv-to-num-plan
priv-to-subaddr priv-to-subaddr-valid priv-to-subaddr-type priv-to-subaddr-odd
priv-to-tag
Reported by: Thomas Arimont
Review: https://reviewboard.asterisk.org/r/2030/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@371120 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-10 19:54:55 +00:00
|
|
|
} else if (!strcasecmp("priv", member.argv[0])) {
|
|
|
|
status = party_id_read(buf, len, member.argc - 1, member.argv + 1,
|
|
|
|
&ast_channel_caller(chan)->priv);
|
|
|
|
switch (status) {
|
|
|
|
case ID_FIELD_VALID:
|
|
|
|
case ID_FIELD_INVALID:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
|
|
|
|
break;
|
|
|
|
}
|
2005-12-23 21:03:25 +00:00
|
|
|
} else {
|
2012-02-29 16:52:47 +00:00
|
|
|
status = party_id_read(buf, len, member.argc, member.argv, &ast_channel_caller(chan)->id);
|
2010-07-14 15:48:36 +00:00
|
|
|
switch (status) {
|
|
|
|
case ID_FIELD_VALID:
|
|
|
|
case ID_FIELD_INVALID:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
|
|
|
|
break;
|
|
|
|
}
|
2005-12-23 21:03:25 +00:00
|
|
|
}
|
2007-11-29 00:28:10 +00:00
|
|
|
|
|
|
|
ast_channel_unlock(chan);
|
2005-05-15 17:45:30 +00:00
|
|
|
}
|
2006-02-12 04:28:58 +00:00
|
|
|
|
2008-10-07 02:02:39 +00:00
|
|
|
return 0;
|
2005-05-15 17:45:30 +00:00
|
|
|
}
|
|
|
|
|
2010-07-14 15:48:36 +00:00
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Write new values to the caller-id information struct.
|
|
|
|
*
|
|
|
|
* \param chan Asterisk channel to update
|
|
|
|
* \param cmd Not used
|
|
|
|
* \param data Caller-id function datatype string
|
|
|
|
* \param value Value to assign to the caller-id information struct.
|
|
|
|
*
|
|
|
|
* \retval 0 on success.
|
|
|
|
* \retval -1 on error.
|
|
|
|
*/
|
|
|
|
static int callerid_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
|
2005-05-15 17:45:30 +00:00
|
|
|
{
|
2010-07-14 15:48:36 +00:00
|
|
|
struct ast_party_caller caller;
|
|
|
|
struct ast_party_dialed dialed;
|
|
|
|
enum ID_FIELD_STATUS status;
|
|
|
|
char *val;
|
|
|
|
char *parms;
|
2017-12-19 01:19:34 +00:00
|
|
|
struct ast_party_func_args args = { 0, };
|
|
|
|
struct ast_party_members member = { 0, };
|
2010-07-14 15:48:36 +00:00
|
|
|
|
|
|
|
if (!value || !chan) {
|
2006-02-12 04:28:58 +00:00
|
|
|
return -1;
|
2010-07-14 15:48:36 +00:00
|
|
|
}
|
2006-02-12 04:28:58 +00:00
|
|
|
|
2010-07-14 15:48:36 +00:00
|
|
|
parms = ast_strdupa(data);
|
|
|
|
AST_STANDARD_APP_ARGS(args, parms);
|
|
|
|
if (args.argc == 0) {
|
|
|
|
/* Must have at least one argument. */
|
|
|
|
return -1;
|
|
|
|
}
|
2008-10-07 02:02:39 +00:00
|
|
|
|
2010-07-14 15:48:36 +00:00
|
|
|
AST_NONSTANDARD_APP_ARGS(member, args.member, '-');
|
|
|
|
if (member.argc == 0 || ARRAY_LEN(member.subnames) <= member.argc) {
|
|
|
|
/* Too few or too many subnames */
|
|
|
|
return -1;
|
|
|
|
}
|
2006-02-12 04:28:58 +00:00
|
|
|
|
2010-07-14 15:48:36 +00:00
|
|
|
value = ast_skip_blanks(value);
|
|
|
|
|
|
|
|
ast_channel_lock(chan);
|
|
|
|
if (member.argc == 1 && !strcasecmp("rdnis", member.argv[0])) {
|
2012-02-29 16:52:47 +00:00
|
|
|
ast_channel_redirecting(chan)->from.number.valid = 1;
|
|
|
|
ast_free(ast_channel_redirecting(chan)->from.number.str);
|
|
|
|
ast_channel_redirecting(chan)->from.number.str = ast_strdup(value);
|
2010-07-14 15:48:36 +00:00
|
|
|
} else if (!strcasecmp("dnid", member.argv[0])) {
|
2012-02-29 16:52:47 +00:00
|
|
|
ast_party_dialed_set_init(&dialed, ast_channel_dialed(chan));
|
2010-07-14 15:48:36 +00:00
|
|
|
if (member.argc == 1) {
|
|
|
|
/* Setup as if user had given dnid-num instead. */
|
|
|
|
member.argc = 2;
|
|
|
|
member.argv[1] = "num";
|
2008-12-04 01:14:22 +00:00
|
|
|
}
|
2010-07-14 15:48:36 +00:00
|
|
|
if (!strncasecmp("num", member.argv[1], 3)) {
|
|
|
|
/*
|
|
|
|
* Accept num[ber]
|
|
|
|
* dnid-num...
|
|
|
|
*/
|
|
|
|
if (member.argc == 2) {
|
|
|
|
/* dnid-num */
|
|
|
|
dialed.number.str = ast_strdup(value);
|
|
|
|
ast_trim_blanks(dialed.number.str);
|
2012-02-29 16:52:47 +00:00
|
|
|
ast_party_dialed_set(ast_channel_dialed(chan), &dialed);
|
2010-07-14 15:48:36 +00:00
|
|
|
} else if (member.argc == 3 && !strcasecmp("plan", member.argv[2])) {
|
|
|
|
/* dnid-num-plan */
|
|
|
|
val = ast_strdupa(value);
|
|
|
|
ast_trim_blanks(val);
|
|
|
|
|
|
|
|
if (('0' <= val[0]) && (val[0] <= '9')) {
|
2012-02-29 16:52:47 +00:00
|
|
|
ast_channel_dialed(chan)->number.plan = atoi(val);
|
2010-07-14 15:48:36 +00:00
|
|
|
} else {
|
|
|
|
ast_log(LOG_ERROR,
|
|
|
|
"Unknown type-of-number/numbering-plan '%s', value unchanged\n", val);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
|
|
|
|
}
|
|
|
|
} else if (!strncasecmp("subaddr", member.argv[1], 7)) {
|
|
|
|
/*
|
|
|
|
* Accept subaddr[ess]
|
|
|
|
* dnid-subaddr...
|
|
|
|
*/
|
|
|
|
status = party_subaddress_write(&dialed.subaddress, member.argc - 2,
|
|
|
|
member.argv + 2, value);
|
|
|
|
switch (status) {
|
|
|
|
case ID_FIELD_VALID:
|
2012-02-29 16:52:47 +00:00
|
|
|
ast_party_dialed_set(ast_channel_dialed(chan), &dialed);
|
2010-07-14 15:48:36 +00:00
|
|
|
break;
|
|
|
|
case ID_FIELD_INVALID:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
|
Enhancements to connected line and redirecting work.
From reviewboard:
Digium has a commercial customer who has made extensive use of the connected party and
redirecting information present in later versions of Asterisk Business Edition and which
is to be in the upcoming 1.8 release. Through their use of the feature, new problems and solutions
have come about. This patch adds several enhancements to maximize usage of the connected party
and redirecting information functionality.
First, Asterisk trunk already had connected line interception macros. These macros allow you to
manipulate connected line information before it was sent out to its target. This patch adds the
same feature except for redirecting information instead.
Second, the ast_callerid and ast_party_id structures have been enhanced to provide a "tag." This
tag can be set with func_callerid, func_connectedline, func_redirecting, and in the case of DAHDI,
mISDN, and SIP channels, can be set in a configuration file. The idea behind the callerid tag is
that it can be set to whatever value the administrator likes. Later, when running connected line
and redirecting macros, the admin can read the tag off the appropriate structure to determine what
action to take. You can think of this sort of like a channel variable, except that instead of having
the variable associated with a channel, the variable is associated with a specific identity within
Asterisk.
Third, app_dial has two new options, s and u. The s option lets a dialplan writer force a specific
caller ID tag to be placed on the outgoing channel. The u option allows the dialplan writer to force
a specific calling presentation value on the outgoing channel.
Fourth, there is a new control frame subclass called AST_CONTROL_READ_ACTION added. This was added
to correct a very specific situation. In the case of SIP semi-attended (blond) transfers, the party
being transferred would not have the opportunity to run a connected line interception macro to
possibly alter the transfer target's connected line information. The issue here was that during a
blond transfer, the SIP transfer code has no bridged channel on which to queue the connected line
update. The way this was corrected was to add this new control frame subclass. Now, we queue an
AST_CONTROL_READ_ACTION frame on the channel on which the connected line interception macro should
be run. When ast_read is called to read the frame, ast_read responds by calling a callback function
associated with the specific read action the control frame describes. In this case, the action taken
is to run the connected line interception macro on the transferee's channel.
Review: https://reviewboard.asterisk.org/r/652/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@263541 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-17 15:36:31 +00:00
|
|
|
}
|
2010-07-14 15:48:36 +00:00
|
|
|
ast_party_dialed_free(&dialed);
|
|
|
|
} else if (member.argc == 1 && !strcasecmp("ani2", member.argv[0])) {
|
|
|
|
val = ast_strdupa(value);
|
|
|
|
ast_trim_blanks(val);
|
|
|
|
|
|
|
|
if (('0' <= val[0]) && (val[0] <= '9')) {
|
2012-02-29 16:52:47 +00:00
|
|
|
ast_channel_caller(chan)->ani2 = atoi(val);
|
2008-10-07 02:02:39 +00:00
|
|
|
} else {
|
2010-07-14 15:48:36 +00:00
|
|
|
ast_log(LOG_ERROR, "Unknown callerid ani2 '%s', value unchanged\n", val);
|
2008-10-07 02:02:39 +00:00
|
|
|
}
|
2010-07-14 16:58:03 +00:00
|
|
|
} else if (!strcasecmp("ani", member.argv[0])) {
|
2012-02-29 16:52:47 +00:00
|
|
|
ast_party_caller_set_init(&caller, ast_channel_caller(chan));
|
2010-07-14 16:58:03 +00:00
|
|
|
if (member.argc == 1) {
|
|
|
|
/* Setup as if user had given ani-num instead. */
|
|
|
|
member.argc = 2;
|
|
|
|
member.argv[1] = "num";
|
|
|
|
}
|
|
|
|
status = party_id_write(&caller.ani, member.argc - 1, member.argv + 1, value);
|
|
|
|
switch (status) {
|
|
|
|
case ID_FIELD_VALID:
|
2012-02-29 16:52:47 +00:00
|
|
|
ast_party_caller_set(ast_channel_caller(chan), &caller, NULL);
|
2010-07-14 16:58:03 +00:00
|
|
|
break;
|
|
|
|
case ID_FIELD_INVALID:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
|
|
|
|
break;
|
2008-12-04 01:14:22 +00:00
|
|
|
}
|
2010-07-14 15:48:36 +00:00
|
|
|
ast_party_caller_free(&caller);
|
Add private representation of caller, connected and redirecting party ids.
This patch adds the feature "Private representation of caller, connected
and redirecting party ids", as previously discussed with us (DATUS) and
Digium.
1. Feature motivation
Until now it is quite difficult to modify a party number or name which can
only be seen by exactly one particular instantiated technology channel
subscriber. One example where a modified party number or name on one
channel is spread over several channels are supplementary services like
call transfer or pickup. To implement these features Asterisk internally
copies caller and connected ids from one channel to another. Another
example are extension subscriptions. The monitoring entities (watchers)
are notified of state changes and - if desired - of party numbers or names
which represent the involving call parties. One major feature where a
private representation of party names is essentially needed, i.e. where a
party name shall be exclusively signaled to only one particular user, is a
private user-specific name resolution for party numbers. A lookup in a
private destination-dependent telephone book shall provide party names
which cannot be seen by any other user at any time.
2. Feature Description
This feature comes along with the implementation of additional private
party id elements for caller id, connected id and redirecting ids inside
Asterisk channels.
The private party id elements can be read or set by the user using
Asterisk dialplan functions.
When a technology channel is initiating a call, receives an internal
connected-line update event, or receives an internal redirecting update
event, it merges the corresponding public id with the private id to create
an effective party id. The effective party id is then used for protocol
signaling.
The channel technologies which initially support the private id
representation with this patch are SIP (chan_sip), mISDN (chan_misdn) and
PRI (chan_dahdi).
Once a private name or number on a channel is set and (implicitly) made
valid, it is generally used for any further protocol signaling until it is
rewritten or invalidated.
To simplify the invalidation of private ids all internally generated
connected/redirecting update events and also all connected/redirecting
update events which are generated by technology channels -- receiving
regarding protocol information - automatically trigger the invalidation of
private ids.
If not using the private party id representation feature at all, i.e. if
using only the 'regular' caller-id, connected and redirecting related
functions, the current characteristic of Asterisk is not affected by the
new extended functionality.
3. User interface Description
To grant access to the private name and number representation from the
Asterisk dialplan, the CALLERID, CONNECTEDLINE and REDIRECTING dialplan
functions are extended by the following data types. The formats of these
data types are equal to the corresponding regular 'non-private' already
existing data types:
CALLERID:
priv-all
priv-name priv-name-valid priv-name-charset priv-name-pres
priv-num priv-num-valid priv-num-plan priv-num-pres
priv-subaddr priv-subaddr-valid priv-subaddr-type priv-subaddr-odd
priv-tag
CONNECTEDLINE:
priv-name priv-name-valid priv-name-pres priv-name-charset
priv-num priv-num-valid priv-num-pres priv-num-plan
priv-subaddr priv-subaddr-valid priv-subaddr-type priv-subaddr-odd
priv-tag
REDIRECTING:
priv-orig-name priv-orig-name-valid priv-orig-name-pres priv-orig-name-charset
priv-orig-num priv-orig-num-valid priv-orig-num-pres priv-orig-num-plan
priv-orig-subaddr priv-orig-subaddr-valid priv-orig-subaddr-type priv-orig-subaddr-odd
priv-orig-tag
priv-from-name priv-from-name-valid priv-from-name-pres priv-from-name-charset
priv-from-num priv-from-num-valid priv-from-num-pres priv-from-num-plan
priv-from-subaddr priv-from-subaddr-valid priv-from-subaddr-type priv-from-subaddr-odd
priv-from-tag
priv-to-name priv-to-name-valid priv-to-name-pres priv-to-name-charset
priv-to-num priv-to-num-valid priv-to-num-pres priv-to-num-plan
priv-to-subaddr priv-to-subaddr-valid priv-to-subaddr-type priv-to-subaddr-odd
priv-to-tag
Reported by: Thomas Arimont
Review: https://reviewboard.asterisk.org/r/2030/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@371120 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-10 19:54:55 +00:00
|
|
|
} else if (!strcasecmp("priv", member.argv[0])) {
|
|
|
|
ast_party_caller_set_init(&caller, ast_channel_caller(chan));
|
|
|
|
status = party_id_write(&caller.priv, member.argc - 1, member.argv + 1, value);
|
|
|
|
switch (status) {
|
|
|
|
case ID_FIELD_VALID:
|
|
|
|
ast_party_caller_set(ast_channel_caller(chan), &caller, NULL);
|
|
|
|
break;
|
|
|
|
case ID_FIELD_INVALID:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
ast_party_caller_free(&caller);
|
2010-07-14 15:48:36 +00:00
|
|
|
} else {
|
2012-02-29 16:52:47 +00:00
|
|
|
ast_party_caller_set_init(&caller, ast_channel_caller(chan));
|
2010-07-14 15:48:36 +00:00
|
|
|
status = party_id_write(&caller.id, member.argc, member.argv, value);
|
|
|
|
switch (status) {
|
|
|
|
case ID_FIELD_VALID:
|
|
|
|
ast_channel_set_caller_event(chan, &caller, NULL);
|
|
|
|
break;
|
|
|
|
case ID_FIELD_INVALID:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
|
|
|
|
break;
|
2009-10-22 16:33:22 +00:00
|
|
|
}
|
2010-07-14 15:48:36 +00:00
|
|
|
ast_party_caller_free(&caller);
|
|
|
|
}
|
|
|
|
ast_channel_unlock(chan);
|
2009-10-22 16:33:22 +00:00
|
|
|
|
2010-07-14 15:48:36 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Read values from the connected line information struct.
|
|
|
|
*
|
|
|
|
* \param chan Asterisk channel to read
|
|
|
|
* \param cmd Not used
|
|
|
|
* \param data Connected line function datatype string
|
|
|
|
* \param buf Buffer to fill with read value.
|
|
|
|
* \param len Length of the buffer
|
|
|
|
*
|
|
|
|
* \retval 0 on success.
|
|
|
|
* \retval -1 on error.
|
|
|
|
*/
|
|
|
|
static int connectedline_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
|
|
|
|
{
|
2017-12-19 01:19:34 +00:00
|
|
|
struct ast_party_members member = { 0, };
|
2010-07-14 15:48:36 +00:00
|
|
|
char *read_what;
|
Add private representation of caller, connected and redirecting party ids.
This patch adds the feature "Private representation of caller, connected
and redirecting party ids", as previously discussed with us (DATUS) and
Digium.
1. Feature motivation
Until now it is quite difficult to modify a party number or name which can
only be seen by exactly one particular instantiated technology channel
subscriber. One example where a modified party number or name on one
channel is spread over several channels are supplementary services like
call transfer or pickup. To implement these features Asterisk internally
copies caller and connected ids from one channel to another. Another
example are extension subscriptions. The monitoring entities (watchers)
are notified of state changes and - if desired - of party numbers or names
which represent the involving call parties. One major feature where a
private representation of party names is essentially needed, i.e. where a
party name shall be exclusively signaled to only one particular user, is a
private user-specific name resolution for party numbers. A lookup in a
private destination-dependent telephone book shall provide party names
which cannot be seen by any other user at any time.
2. Feature Description
This feature comes along with the implementation of additional private
party id elements for caller id, connected id and redirecting ids inside
Asterisk channels.
The private party id elements can be read or set by the user using
Asterisk dialplan functions.
When a technology channel is initiating a call, receives an internal
connected-line update event, or receives an internal redirecting update
event, it merges the corresponding public id with the private id to create
an effective party id. The effective party id is then used for protocol
signaling.
The channel technologies which initially support the private id
representation with this patch are SIP (chan_sip), mISDN (chan_misdn) and
PRI (chan_dahdi).
Once a private name or number on a channel is set and (implicitly) made
valid, it is generally used for any further protocol signaling until it is
rewritten or invalidated.
To simplify the invalidation of private ids all internally generated
connected/redirecting update events and also all connected/redirecting
update events which are generated by technology channels -- receiving
regarding protocol information - automatically trigger the invalidation of
private ids.
If not using the private party id representation feature at all, i.e. if
using only the 'regular' caller-id, connected and redirecting related
functions, the current characteristic of Asterisk is not affected by the
new extended functionality.
3. User interface Description
To grant access to the private name and number representation from the
Asterisk dialplan, the CALLERID, CONNECTEDLINE and REDIRECTING dialplan
functions are extended by the following data types. The formats of these
data types are equal to the corresponding regular 'non-private' already
existing data types:
CALLERID:
priv-all
priv-name priv-name-valid priv-name-charset priv-name-pres
priv-num priv-num-valid priv-num-plan priv-num-pres
priv-subaddr priv-subaddr-valid priv-subaddr-type priv-subaddr-odd
priv-tag
CONNECTEDLINE:
priv-name priv-name-valid priv-name-pres priv-name-charset
priv-num priv-num-valid priv-num-pres priv-num-plan
priv-subaddr priv-subaddr-valid priv-subaddr-type priv-subaddr-odd
priv-tag
REDIRECTING:
priv-orig-name priv-orig-name-valid priv-orig-name-pres priv-orig-name-charset
priv-orig-num priv-orig-num-valid priv-orig-num-pres priv-orig-num-plan
priv-orig-subaddr priv-orig-subaddr-valid priv-orig-subaddr-type priv-orig-subaddr-odd
priv-orig-tag
priv-from-name priv-from-name-valid priv-from-name-pres priv-from-name-charset
priv-from-num priv-from-num-valid priv-from-num-pres priv-from-num-plan
priv-from-subaddr priv-from-subaddr-valid priv-from-subaddr-type priv-from-subaddr-odd
priv-from-tag
priv-to-name priv-to-name-valid priv-to-name-pres priv-to-name-charset
priv-to-num priv-to-num-valid priv-to-num-pres priv-to-num-plan
priv-to-subaddr priv-to-subaddr-valid priv-to-subaddr-type priv-to-subaddr-odd
priv-to-tag
Reported by: Thomas Arimont
Review: https://reviewboard.asterisk.org/r/2030/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@371120 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-10 19:54:55 +00:00
|
|
|
enum ID_FIELD_STATUS status;
|
2010-07-14 15:48:36 +00:00
|
|
|
|
|
|
|
/* Ensure that the buffer is empty */
|
|
|
|
*buf = 0;
|
|
|
|
|
|
|
|
if (!chan) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
read_what = ast_strdupa(data);
|
|
|
|
AST_NONSTANDARD_APP_ARGS(member, read_what, '-');
|
|
|
|
if (member.argc == 0 || ARRAY_LEN(member.subnames) <= member.argc) {
|
|
|
|
/* Too few or too many subnames */
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
ast_channel_lock(chan);
|
|
|
|
|
|
|
|
if (member.argc == 1 && !strcasecmp("source", member.argv[0])) {
|
2012-02-29 16:52:47 +00:00
|
|
|
ast_copy_string(buf, ast_connected_line_source_name(ast_channel_connected(chan)->source), len);
|
Add private representation of caller, connected and redirecting party ids.
This patch adds the feature "Private representation of caller, connected
and redirecting party ids", as previously discussed with us (DATUS) and
Digium.
1. Feature motivation
Until now it is quite difficult to modify a party number or name which can
only be seen by exactly one particular instantiated technology channel
subscriber. One example where a modified party number or name on one
channel is spread over several channels are supplementary services like
call transfer or pickup. To implement these features Asterisk internally
copies caller and connected ids from one channel to another. Another
example are extension subscriptions. The monitoring entities (watchers)
are notified of state changes and - if desired - of party numbers or names
which represent the involving call parties. One major feature where a
private representation of party names is essentially needed, i.e. where a
party name shall be exclusively signaled to only one particular user, is a
private user-specific name resolution for party numbers. A lookup in a
private destination-dependent telephone book shall provide party names
which cannot be seen by any other user at any time.
2. Feature Description
This feature comes along with the implementation of additional private
party id elements for caller id, connected id and redirecting ids inside
Asterisk channels.
The private party id elements can be read or set by the user using
Asterisk dialplan functions.
When a technology channel is initiating a call, receives an internal
connected-line update event, or receives an internal redirecting update
event, it merges the corresponding public id with the private id to create
an effective party id. The effective party id is then used for protocol
signaling.
The channel technologies which initially support the private id
representation with this patch are SIP (chan_sip), mISDN (chan_misdn) and
PRI (chan_dahdi).
Once a private name or number on a channel is set and (implicitly) made
valid, it is generally used for any further protocol signaling until it is
rewritten or invalidated.
To simplify the invalidation of private ids all internally generated
connected/redirecting update events and also all connected/redirecting
update events which are generated by technology channels -- receiving
regarding protocol information - automatically trigger the invalidation of
private ids.
If not using the private party id representation feature at all, i.e. if
using only the 'regular' caller-id, connected and redirecting related
functions, the current characteristic of Asterisk is not affected by the
new extended functionality.
3. User interface Description
To grant access to the private name and number representation from the
Asterisk dialplan, the CALLERID, CONNECTEDLINE and REDIRECTING dialplan
functions are extended by the following data types. The formats of these
data types are equal to the corresponding regular 'non-private' already
existing data types:
CALLERID:
priv-all
priv-name priv-name-valid priv-name-charset priv-name-pres
priv-num priv-num-valid priv-num-plan priv-num-pres
priv-subaddr priv-subaddr-valid priv-subaddr-type priv-subaddr-odd
priv-tag
CONNECTEDLINE:
priv-name priv-name-valid priv-name-pres priv-name-charset
priv-num priv-num-valid priv-num-pres priv-num-plan
priv-subaddr priv-subaddr-valid priv-subaddr-type priv-subaddr-odd
priv-tag
REDIRECTING:
priv-orig-name priv-orig-name-valid priv-orig-name-pres priv-orig-name-charset
priv-orig-num priv-orig-num-valid priv-orig-num-pres priv-orig-num-plan
priv-orig-subaddr priv-orig-subaddr-valid priv-orig-subaddr-type priv-orig-subaddr-odd
priv-orig-tag
priv-from-name priv-from-name-valid priv-from-name-pres priv-from-name-charset
priv-from-num priv-from-num-valid priv-from-num-pres priv-from-num-plan
priv-from-subaddr priv-from-subaddr-valid priv-from-subaddr-type priv-from-subaddr-odd
priv-from-tag
priv-to-name priv-to-name-valid priv-to-name-pres priv-to-name-charset
priv-to-num priv-to-num-valid priv-to-num-pres priv-to-num-plan
priv-to-subaddr priv-to-subaddr-valid priv-to-subaddr-type priv-to-subaddr-odd
priv-to-tag
Reported by: Thomas Arimont
Review: https://reviewboard.asterisk.org/r/2030/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@371120 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-10 19:54:55 +00:00
|
|
|
} else if (!strcasecmp("priv", member.argv[0])) {
|
|
|
|
status = party_id_read(buf, len, member.argc - 1, member.argv + 1,
|
|
|
|
&ast_channel_connected(chan)->priv);
|
|
|
|
switch (status) {
|
|
|
|
case ID_FIELD_VALID:
|
|
|
|
case ID_FIELD_INVALID:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ast_log(LOG_ERROR, "Unknown connectedline data type '%s'.\n", data);
|
|
|
|
break;
|
|
|
|
}
|
2010-07-14 15:48:36 +00:00
|
|
|
} else {
|
2012-02-29 16:52:47 +00:00
|
|
|
status = party_id_read(buf, len, member.argc, member.argv, &ast_channel_connected(chan)->id);
|
2010-07-14 15:48:36 +00:00
|
|
|
switch (status) {
|
|
|
|
case ID_FIELD_VALID:
|
|
|
|
case ID_FIELD_INVALID:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ast_log(LOG_ERROR, "Unknown connectedline data type '%s'.\n", data);
|
|
|
|
break;
|
2009-10-22 16:33:22 +00:00
|
|
|
}
|
2010-07-14 15:48:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ast_channel_unlock(chan);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Write new values to the connected line information struct.
|
|
|
|
*
|
|
|
|
* \param chan Asterisk channel to update
|
|
|
|
* \param cmd Not used
|
|
|
|
* \param data Connected line function datatype string
|
|
|
|
* \param value Value to assign to the connected line information struct.
|
|
|
|
*
|
|
|
|
* \retval 0 on success.
|
|
|
|
* \retval -1 on error.
|
|
|
|
*/
|
|
|
|
static int connectedline_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
|
|
|
|
{
|
|
|
|
struct ast_party_connected_line connected;
|
|
|
|
char *val;
|
|
|
|
char *parms;
|
|
|
|
void (*set_it)(struct ast_channel *chan, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update);
|
2017-12-19 01:19:34 +00:00
|
|
|
struct ast_party_func_args args = { 0, };
|
|
|
|
struct ast_party_members member = { 0, };
|
2010-07-14 15:48:36 +00:00
|
|
|
struct ast_flags opts;
|
|
|
|
char *opt_args[CONNECTED_LINE_OPT_ARG_ARRAY_SIZE];
|
Add private representation of caller, connected and redirecting party ids.
This patch adds the feature "Private representation of caller, connected
and redirecting party ids", as previously discussed with us (DATUS) and
Digium.
1. Feature motivation
Until now it is quite difficult to modify a party number or name which can
only be seen by exactly one particular instantiated technology channel
subscriber. One example where a modified party number or name on one
channel is spread over several channels are supplementary services like
call transfer or pickup. To implement these features Asterisk internally
copies caller and connected ids from one channel to another. Another
example are extension subscriptions. The monitoring entities (watchers)
are notified of state changes and - if desired - of party numbers or names
which represent the involving call parties. One major feature where a
private representation of party names is essentially needed, i.e. where a
party name shall be exclusively signaled to only one particular user, is a
private user-specific name resolution for party numbers. A lookup in a
private destination-dependent telephone book shall provide party names
which cannot be seen by any other user at any time.
2. Feature Description
This feature comes along with the implementation of additional private
party id elements for caller id, connected id and redirecting ids inside
Asterisk channels.
The private party id elements can be read or set by the user using
Asterisk dialplan functions.
When a technology channel is initiating a call, receives an internal
connected-line update event, or receives an internal redirecting update
event, it merges the corresponding public id with the private id to create
an effective party id. The effective party id is then used for protocol
signaling.
The channel technologies which initially support the private id
representation with this patch are SIP (chan_sip), mISDN (chan_misdn) and
PRI (chan_dahdi).
Once a private name or number on a channel is set and (implicitly) made
valid, it is generally used for any further protocol signaling until it is
rewritten or invalidated.
To simplify the invalidation of private ids all internally generated
connected/redirecting update events and also all connected/redirecting
update events which are generated by technology channels -- receiving
regarding protocol information - automatically trigger the invalidation of
private ids.
If not using the private party id representation feature at all, i.e. if
using only the 'regular' caller-id, connected and redirecting related
functions, the current characteristic of Asterisk is not affected by the
new extended functionality.
3. User interface Description
To grant access to the private name and number representation from the
Asterisk dialplan, the CALLERID, CONNECTEDLINE and REDIRECTING dialplan
functions are extended by the following data types. The formats of these
data types are equal to the corresponding regular 'non-private' already
existing data types:
CALLERID:
priv-all
priv-name priv-name-valid priv-name-charset priv-name-pres
priv-num priv-num-valid priv-num-plan priv-num-pres
priv-subaddr priv-subaddr-valid priv-subaddr-type priv-subaddr-odd
priv-tag
CONNECTEDLINE:
priv-name priv-name-valid priv-name-pres priv-name-charset
priv-num priv-num-valid priv-num-pres priv-num-plan
priv-subaddr priv-subaddr-valid priv-subaddr-type priv-subaddr-odd
priv-tag
REDIRECTING:
priv-orig-name priv-orig-name-valid priv-orig-name-pres priv-orig-name-charset
priv-orig-num priv-orig-num-valid priv-orig-num-pres priv-orig-num-plan
priv-orig-subaddr priv-orig-subaddr-valid priv-orig-subaddr-type priv-orig-subaddr-odd
priv-orig-tag
priv-from-name priv-from-name-valid priv-from-name-pres priv-from-name-charset
priv-from-num priv-from-num-valid priv-from-num-pres priv-from-num-plan
priv-from-subaddr priv-from-subaddr-valid priv-from-subaddr-type priv-from-subaddr-odd
priv-from-tag
priv-to-name priv-to-name-valid priv-to-name-pres priv-to-name-charset
priv-to-num priv-to-num-valid priv-to-num-pres priv-to-num-plan
priv-to-subaddr priv-to-subaddr-valid priv-to-subaddr-type priv-to-subaddr-odd
priv-to-tag
Reported by: Thomas Arimont
Review: https://reviewboard.asterisk.org/r/2030/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@371120 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-10 19:54:55 +00:00
|
|
|
enum ID_FIELD_STATUS status;
|
2010-07-14 15:48:36 +00:00
|
|
|
|
|
|
|
if (!value || !chan) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
parms = ast_strdupa(data);
|
|
|
|
AST_STANDARD_APP_ARGS(args, parms);
|
|
|
|
if (args.argc == 0) {
|
|
|
|
/* Must have at least one argument. */
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
AST_NONSTANDARD_APP_ARGS(member, args.member, '-');
|
|
|
|
if (member.argc == 0 || ARRAY_LEN(member.subnames) <= member.argc) {
|
|
|
|
/* Too few or too many subnames */
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ast_app_parse_options(connectedline_opts, &opts, opt_args, args.opts)) {
|
|
|
|
/* General invalid option syntax. */
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Determine if the update indication inhibit option is present */
|
|
|
|
if (ast_test_flag(&opts, CONNECTED_LINE_OPT_INHIBIT)) {
|
|
|
|
set_it = ast_channel_set_connected_line;
|
|
|
|
} else {
|
|
|
|
set_it = ast_channel_update_connected_line;
|
|
|
|
}
|
|
|
|
|
|
|
|
ast_channel_lock(chan);
|
2012-02-29 16:52:47 +00:00
|
|
|
ast_party_connected_line_set_init(&connected, ast_channel_connected(chan));
|
2010-07-14 15:48:36 +00:00
|
|
|
ast_channel_unlock(chan);
|
|
|
|
|
|
|
|
value = ast_skip_blanks(value);
|
|
|
|
|
|
|
|
if (member.argc == 1 && !strcasecmp("source", member.argv[0])) {
|
|
|
|
int source;
|
|
|
|
|
|
|
|
val = ast_strdupa(value);
|
|
|
|
ast_trim_blanks(val);
|
|
|
|
|
|
|
|
if (('0' <= val[0]) && (val[0] <= '9')) {
|
|
|
|
source = atoi(val);
|
|
|
|
} else {
|
|
|
|
source = ast_connected_line_source_parse(val);
|
2008-10-07 02:02:39 +00:00
|
|
|
}
|
2010-07-14 15:48:36 +00:00
|
|
|
|
|
|
|
if (source < 0) {
|
|
|
|
ast_log(LOG_ERROR, "Unknown connectedline source '%s', value unchanged\n", val);
|
|
|
|
} else {
|
|
|
|
connected.source = source;
|
|
|
|
set_it(chan, &connected, NULL);
|
2008-12-04 01:14:22 +00:00
|
|
|
}
|
Add private representation of caller, connected and redirecting party ids.
This patch adds the feature "Private representation of caller, connected
and redirecting party ids", as previously discussed with us (DATUS) and
Digium.
1. Feature motivation
Until now it is quite difficult to modify a party number or name which can
only be seen by exactly one particular instantiated technology channel
subscriber. One example where a modified party number or name on one
channel is spread over several channels are supplementary services like
call transfer or pickup. To implement these features Asterisk internally
copies caller and connected ids from one channel to another. Another
example are extension subscriptions. The monitoring entities (watchers)
are notified of state changes and - if desired - of party numbers or names
which represent the involving call parties. One major feature where a
private representation of party names is essentially needed, i.e. where a
party name shall be exclusively signaled to only one particular user, is a
private user-specific name resolution for party numbers. A lookup in a
private destination-dependent telephone book shall provide party names
which cannot be seen by any other user at any time.
2. Feature Description
This feature comes along with the implementation of additional private
party id elements for caller id, connected id and redirecting ids inside
Asterisk channels.
The private party id elements can be read or set by the user using
Asterisk dialplan functions.
When a technology channel is initiating a call, receives an internal
connected-line update event, or receives an internal redirecting update
event, it merges the corresponding public id with the private id to create
an effective party id. The effective party id is then used for protocol
signaling.
The channel technologies which initially support the private id
representation with this patch are SIP (chan_sip), mISDN (chan_misdn) and
PRI (chan_dahdi).
Once a private name or number on a channel is set and (implicitly) made
valid, it is generally used for any further protocol signaling until it is
rewritten or invalidated.
To simplify the invalidation of private ids all internally generated
connected/redirecting update events and also all connected/redirecting
update events which are generated by technology channels -- receiving
regarding protocol information - automatically trigger the invalidation of
private ids.
If not using the private party id representation feature at all, i.e. if
using only the 'regular' caller-id, connected and redirecting related
functions, the current characteristic of Asterisk is not affected by the
new extended functionality.
3. User interface Description
To grant access to the private name and number representation from the
Asterisk dialplan, the CALLERID, CONNECTEDLINE and REDIRECTING dialplan
functions are extended by the following data types. The formats of these
data types are equal to the corresponding regular 'non-private' already
existing data types:
CALLERID:
priv-all
priv-name priv-name-valid priv-name-charset priv-name-pres
priv-num priv-num-valid priv-num-plan priv-num-pres
priv-subaddr priv-subaddr-valid priv-subaddr-type priv-subaddr-odd
priv-tag
CONNECTEDLINE:
priv-name priv-name-valid priv-name-pres priv-name-charset
priv-num priv-num-valid priv-num-pres priv-num-plan
priv-subaddr priv-subaddr-valid priv-subaddr-type priv-subaddr-odd
priv-tag
REDIRECTING:
priv-orig-name priv-orig-name-valid priv-orig-name-pres priv-orig-name-charset
priv-orig-num priv-orig-num-valid priv-orig-num-pres priv-orig-num-plan
priv-orig-subaddr priv-orig-subaddr-valid priv-orig-subaddr-type priv-orig-subaddr-odd
priv-orig-tag
priv-from-name priv-from-name-valid priv-from-name-pres priv-from-name-charset
priv-from-num priv-from-num-valid priv-from-num-pres priv-from-num-plan
priv-from-subaddr priv-from-subaddr-valid priv-from-subaddr-type priv-from-subaddr-odd
priv-from-tag
priv-to-name priv-to-name-valid priv-to-name-pres priv-to-name-charset
priv-to-num priv-to-num-valid priv-to-num-pres priv-to-num-plan
priv-to-subaddr priv-to-subaddr-valid priv-to-subaddr-type priv-to-subaddr-odd
priv-to-tag
Reported by: Thomas Arimont
Review: https://reviewboard.asterisk.org/r/2030/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@371120 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-10 19:54:55 +00:00
|
|
|
} else if (!strcasecmp("priv", member.argv[0])) {
|
|
|
|
status = party_id_write(&connected.priv, member.argc - 1, member.argv + 1, value);
|
|
|
|
switch (status) {
|
|
|
|
case ID_FIELD_VALID:
|
|
|
|
set_it(chan, &connected, NULL);
|
|
|
|
break;
|
|
|
|
case ID_FIELD_INVALID:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ast_log(LOG_ERROR, "Unknown connectedline data type '%s'.\n", data);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
ast_party_connected_line_free(&connected);
|
2010-07-14 15:48:36 +00:00
|
|
|
} else {
|
|
|
|
status = party_id_write(&connected.id, member.argc, member.argv, value);
|
|
|
|
switch (status) {
|
|
|
|
case ID_FIELD_VALID:
|
|
|
|
set_it(chan, &connected, NULL);
|
|
|
|
break;
|
|
|
|
case ID_FIELD_INVALID:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ast_log(LOG_ERROR, "Unknown connectedline data type '%s'.\n", data);
|
|
|
|
break;
|
2008-12-04 01:14:22 +00:00
|
|
|
}
|
2010-07-14 15:48:36 +00:00
|
|
|
ast_party_connected_line_free(&connected);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Read values from the redirecting information struct.
|
|
|
|
*
|
|
|
|
* \param chan Asterisk channel to read
|
|
|
|
* \param cmd Not used
|
|
|
|
* \param data Redirecting function datatype string
|
|
|
|
* \param buf Buffer to fill with read value.
|
|
|
|
* \param len Length of the buffer
|
|
|
|
*
|
|
|
|
* \retval 0 on success.
|
|
|
|
* \retval -1 on error.
|
|
|
|
*/
|
|
|
|
static int redirecting_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
|
|
|
|
{
|
2017-12-19 01:19:34 +00:00
|
|
|
struct ast_party_members member = { 0, };
|
2010-07-14 15:48:36 +00:00
|
|
|
char *read_what;
|
2012-04-20 00:57:13 +00:00
|
|
|
const struct ast_party_redirecting *ast_redirecting;
|
2010-07-14 15:48:36 +00:00
|
|
|
enum ID_FIELD_STATUS status;
|
|
|
|
|
|
|
|
/* Ensure that the buffer is empty */
|
|
|
|
*buf = 0;
|
|
|
|
|
|
|
|
if (!chan) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
read_what = ast_strdupa(data);
|
|
|
|
AST_NONSTANDARD_APP_ARGS(member, read_what, '-');
|
|
|
|
if (member.argc == 0 || ARRAY_LEN(member.subnames) <= member.argc) {
|
|
|
|
/* Too few or too many subnames */
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
ast_channel_lock(chan);
|
|
|
|
|
2012-04-20 00:57:13 +00:00
|
|
|
ast_redirecting = ast_channel_redirecting(chan);
|
|
|
|
if (!strcasecmp("orig", member.argv[0])) {
|
|
|
|
if (member.argc == 2 && !strcasecmp("reason", member.argv[1])) {
|
|
|
|
ast_copy_string(buf,
|
2012-09-25 19:29:14 +00:00
|
|
|
ast_redirecting_reason_name(&ast_redirecting->orig_reason), len);
|
2012-04-20 00:57:13 +00:00
|
|
|
} else {
|
|
|
|
status = party_id_read(buf, len, member.argc - 1, member.argv + 1,
|
|
|
|
&ast_redirecting->orig);
|
|
|
|
switch (status) {
|
|
|
|
case ID_FIELD_VALID:
|
|
|
|
case ID_FIELD_INVALID:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (!strcasecmp("from", member.argv[0])) {
|
2010-07-14 15:48:36 +00:00
|
|
|
status = party_id_read(buf, len, member.argc - 1, member.argv + 1,
|
2012-04-20 00:57:13 +00:00
|
|
|
&ast_redirecting->from);
|
2010-07-14 15:48:36 +00:00
|
|
|
switch (status) {
|
|
|
|
case ID_FIELD_VALID:
|
|
|
|
case ID_FIELD_INVALID:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else if (!strcasecmp("to", member.argv[0])) {
|
|
|
|
status = party_id_read(buf, len, member.argc - 1, member.argv + 1,
|
2012-04-20 00:57:13 +00:00
|
|
|
&ast_redirecting->to);
|
2010-07-14 15:48:36 +00:00
|
|
|
switch (status) {
|
|
|
|
case ID_FIELD_VALID:
|
|
|
|
case ID_FIELD_INVALID:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else if (member.argc == 1 && !strncasecmp("pres", member.argv[0], 4)) {
|
|
|
|
/*
|
|
|
|
* Accept pres[entation]
|
|
|
|
* This is the combined from name/number presentation.
|
|
|
|
*/
|
|
|
|
ast_copy_string(buf,
|
|
|
|
ast_named_caller_presentation(
|
2012-04-20 00:57:13 +00:00
|
|
|
ast_party_id_presentation(&ast_redirecting->from)), len);
|
2010-07-14 15:48:36 +00:00
|
|
|
} else if (member.argc == 1 && !strcasecmp("reason", member.argv[0])) {
|
2012-09-25 19:29:14 +00:00
|
|
|
ast_copy_string(buf, ast_redirecting_reason_name(&ast_redirecting->reason), len);
|
2010-07-14 15:48:36 +00:00
|
|
|
} else if (member.argc == 1 && !strcasecmp("count", member.argv[0])) {
|
2012-04-20 00:57:13 +00:00
|
|
|
snprintf(buf, len, "%d", ast_redirecting->count);
|
Add private representation of caller, connected and redirecting party ids.
This patch adds the feature "Private representation of caller, connected
and redirecting party ids", as previously discussed with us (DATUS) and
Digium.
1. Feature motivation
Until now it is quite difficult to modify a party number or name which can
only be seen by exactly one particular instantiated technology channel
subscriber. One example where a modified party number or name on one
channel is spread over several channels are supplementary services like
call transfer or pickup. To implement these features Asterisk internally
copies caller and connected ids from one channel to another. Another
example are extension subscriptions. The monitoring entities (watchers)
are notified of state changes and - if desired - of party numbers or names
which represent the involving call parties. One major feature where a
private representation of party names is essentially needed, i.e. where a
party name shall be exclusively signaled to only one particular user, is a
private user-specific name resolution for party numbers. A lookup in a
private destination-dependent telephone book shall provide party names
which cannot be seen by any other user at any time.
2. Feature Description
This feature comes along with the implementation of additional private
party id elements for caller id, connected id and redirecting ids inside
Asterisk channels.
The private party id elements can be read or set by the user using
Asterisk dialplan functions.
When a technology channel is initiating a call, receives an internal
connected-line update event, or receives an internal redirecting update
event, it merges the corresponding public id with the private id to create
an effective party id. The effective party id is then used for protocol
signaling.
The channel technologies which initially support the private id
representation with this patch are SIP (chan_sip), mISDN (chan_misdn) and
PRI (chan_dahdi).
Once a private name or number on a channel is set and (implicitly) made
valid, it is generally used for any further protocol signaling until it is
rewritten or invalidated.
To simplify the invalidation of private ids all internally generated
connected/redirecting update events and also all connected/redirecting
update events which are generated by technology channels -- receiving
regarding protocol information - automatically trigger the invalidation of
private ids.
If not using the private party id representation feature at all, i.e. if
using only the 'regular' caller-id, connected and redirecting related
functions, the current characteristic of Asterisk is not affected by the
new extended functionality.
3. User interface Description
To grant access to the private name and number representation from the
Asterisk dialplan, the CALLERID, CONNECTEDLINE and REDIRECTING dialplan
functions are extended by the following data types. The formats of these
data types are equal to the corresponding regular 'non-private' already
existing data types:
CALLERID:
priv-all
priv-name priv-name-valid priv-name-charset priv-name-pres
priv-num priv-num-valid priv-num-plan priv-num-pres
priv-subaddr priv-subaddr-valid priv-subaddr-type priv-subaddr-odd
priv-tag
CONNECTEDLINE:
priv-name priv-name-valid priv-name-pres priv-name-charset
priv-num priv-num-valid priv-num-pres priv-num-plan
priv-subaddr priv-subaddr-valid priv-subaddr-type priv-subaddr-odd
priv-tag
REDIRECTING:
priv-orig-name priv-orig-name-valid priv-orig-name-pres priv-orig-name-charset
priv-orig-num priv-orig-num-valid priv-orig-num-pres priv-orig-num-plan
priv-orig-subaddr priv-orig-subaddr-valid priv-orig-subaddr-type priv-orig-subaddr-odd
priv-orig-tag
priv-from-name priv-from-name-valid priv-from-name-pres priv-from-name-charset
priv-from-num priv-from-num-valid priv-from-num-pres priv-from-num-plan
priv-from-subaddr priv-from-subaddr-valid priv-from-subaddr-type priv-from-subaddr-odd
priv-from-tag
priv-to-name priv-to-name-valid priv-to-name-pres priv-to-name-charset
priv-to-num priv-to-num-valid priv-to-num-pres priv-to-num-plan
priv-to-subaddr priv-to-subaddr-valid priv-to-subaddr-type priv-to-subaddr-odd
priv-to-tag
Reported by: Thomas Arimont
Review: https://reviewboard.asterisk.org/r/2030/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@371120 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-10 19:54:55 +00:00
|
|
|
} else if (1 < member.argc && !strcasecmp("priv", member.argv[0])) {
|
|
|
|
if (!strcasecmp("orig", member.argv[1])) {
|
|
|
|
status = party_id_read(buf, len, member.argc - 2, member.argv + 2,
|
|
|
|
&ast_redirecting->priv_orig);
|
|
|
|
switch (status) {
|
|
|
|
case ID_FIELD_VALID:
|
|
|
|
case ID_FIELD_INVALID:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else if (!strcasecmp("from", member.argv[1])) {
|
|
|
|
status = party_id_read(buf, len, member.argc - 2, member.argv + 2,
|
|
|
|
&ast_redirecting->priv_from);
|
|
|
|
switch (status) {
|
|
|
|
case ID_FIELD_VALID:
|
|
|
|
case ID_FIELD_INVALID:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else if (!strcasecmp("to", member.argv[1])) {
|
|
|
|
status = party_id_read(buf, len, member.argc - 2, member.argv + 2,
|
|
|
|
&ast_redirecting->priv_to);
|
|
|
|
switch (status) {
|
|
|
|
case ID_FIELD_VALID:
|
|
|
|
case ID_FIELD_INVALID:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
|
|
|
|
}
|
2010-07-14 15:48:36 +00:00
|
|
|
} else {
|
|
|
|
ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
|
|
|
|
}
|
|
|
|
|
|
|
|
ast_channel_unlock(chan);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Write new values to the redirecting information struct.
|
|
|
|
*
|
|
|
|
* \param chan Asterisk channel to update
|
|
|
|
* \param cmd Not used
|
|
|
|
* \param data Redirecting function datatype string
|
|
|
|
* \param value Value to assign to the redirecting information struct.
|
|
|
|
*
|
|
|
|
* \retval 0 on success.
|
|
|
|
* \retval -1 on error.
|
|
|
|
*/
|
|
|
|
static int redirecting_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
|
|
|
|
{
|
|
|
|
struct ast_party_redirecting redirecting;
|
|
|
|
enum ID_FIELD_STATUS status;
|
|
|
|
char *val;
|
|
|
|
char *parms;
|
|
|
|
void (*set_it)(struct ast_channel *chan, const struct ast_party_redirecting *redirecting, const struct ast_set_party_redirecting *update);
|
2017-12-19 01:19:34 +00:00
|
|
|
struct ast_party_func_args args = { 0, };
|
|
|
|
struct ast_party_members member = { 0, };
|
2010-07-14 15:48:36 +00:00
|
|
|
struct ast_flags opts;
|
|
|
|
char *opt_args[REDIRECTING_OPT_ARG_ARRAY_SIZE];
|
|
|
|
|
|
|
|
if (!value || !chan) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
parms = ast_strdupa(data);
|
|
|
|
AST_STANDARD_APP_ARGS(args, parms);
|
|
|
|
if (args.argc == 0) {
|
|
|
|
/* Must have at least one argument. */
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
AST_NONSTANDARD_APP_ARGS(member, args.member, '-');
|
|
|
|
if (member.argc == 0 || ARRAY_LEN(member.subnames) <= member.argc) {
|
|
|
|
/* Too few or too many subnames */
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ast_app_parse_options(redirecting_opts, &opts, opt_args, args.opts)) {
|
|
|
|
/* General invalid option syntax. */
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Determine if the update indication inhibit option is present */
|
|
|
|
if (ast_test_flag(&opts, REDIRECTING_OPT_INHIBIT)) {
|
|
|
|
set_it = ast_channel_set_redirecting;
|
|
|
|
} else {
|
|
|
|
set_it = ast_channel_update_redirecting;
|
|
|
|
}
|
|
|
|
|
|
|
|
ast_channel_lock(chan);
|
2012-02-29 16:52:47 +00:00
|
|
|
ast_party_redirecting_set_init(&redirecting, ast_channel_redirecting(chan));
|
2010-07-14 15:48:36 +00:00
|
|
|
ast_channel_unlock(chan);
|
|
|
|
|
|
|
|
value = ast_skip_blanks(value);
|
|
|
|
|
2012-04-20 00:57:13 +00:00
|
|
|
if (!strcasecmp("orig", member.argv[0])) {
|
|
|
|
if (member.argc == 2 && !strcasecmp("reason", member.argv[1])) {
|
|
|
|
int reason;
|
|
|
|
|
|
|
|
val = ast_strdupa(value);
|
|
|
|
ast_trim_blanks(val);
|
|
|
|
|
|
|
|
if (('0' <= val[0]) && (val[0] <= '9')) {
|
|
|
|
reason = atoi(val);
|
|
|
|
} else {
|
|
|
|
reason = ast_redirecting_reason_parse(val);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (reason < 0) {
|
2012-09-25 19:29:14 +00:00
|
|
|
/* The argument passed into the function does not correspond to a pre-defined
|
|
|
|
* reason, so we can just set the reason string to what was given and set the
|
|
|
|
* code to be unknown
|
|
|
|
*/
|
|
|
|
redirecting.orig_reason.code = AST_REDIRECTING_REASON_UNKNOWN;
|
|
|
|
redirecting.orig_reason.str = val;
|
|
|
|
set_it(chan, &redirecting, NULL);
|
2012-04-20 00:57:13 +00:00
|
|
|
} else {
|
2012-09-25 19:29:14 +00:00
|
|
|
redirecting.orig_reason.code = reason;
|
|
|
|
redirecting.orig_reason.str = "";
|
2012-04-20 00:57:13 +00:00
|
|
|
set_it(chan, &redirecting, NULL);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
status = party_id_write(&redirecting.orig, member.argc - 1, member.argv + 1,
|
|
|
|
value);
|
|
|
|
switch (status) {
|
|
|
|
case ID_FIELD_VALID:
|
|
|
|
set_it(chan, &redirecting, NULL);
|
|
|
|
break;
|
|
|
|
case ID_FIELD_INVALID:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
ast_party_redirecting_free(&redirecting);
|
|
|
|
}
|
|
|
|
} else if (!strcasecmp("from", member.argv[0])) {
|
2010-07-14 15:48:36 +00:00
|
|
|
status = party_id_write(&redirecting.from, member.argc - 1, member.argv + 1,
|
|
|
|
value);
|
|
|
|
switch (status) {
|
|
|
|
case ID_FIELD_VALID:
|
|
|
|
set_it(chan, &redirecting, NULL);
|
|
|
|
break;
|
|
|
|
case ID_FIELD_INVALID:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
ast_party_redirecting_free(&redirecting);
|
|
|
|
} else if (!strcasecmp("to", member.argv[0])) {
|
|
|
|
status = party_id_write(&redirecting.to, member.argc - 1, member.argv + 1, value);
|
|
|
|
switch (status) {
|
|
|
|
case ID_FIELD_VALID:
|
|
|
|
set_it(chan, &redirecting, NULL);
|
|
|
|
break;
|
|
|
|
case ID_FIELD_INVALID:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
ast_party_redirecting_free(&redirecting);
|
|
|
|
} else if (member.argc == 1 && !strncasecmp("pres", member.argv[0], 4)) {
|
|
|
|
int pres;
|
2006-10-07 14:45:49 +00:00
|
|
|
|
|
|
|
val = ast_strdupa(value);
|
2008-10-07 02:02:39 +00:00
|
|
|
ast_trim_blanks(val);
|
2006-10-07 14:45:49 +00:00
|
|
|
|
2010-07-14 15:48:36 +00:00
|
|
|
if (('0' <= val[0]) && (val[0] <= '9')) {
|
|
|
|
pres = atoi(val);
|
|
|
|
} else {
|
|
|
|
pres = ast_parse_caller_presentation(val);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pres < 0) {
|
|
|
|
ast_log(LOG_ERROR,
|
|
|
|
"Unknown redirecting combined presentation '%s', value unchanged\n", val);
|
|
|
|
} else {
|
|
|
|
redirecting.from.name.presentation = pres;
|
|
|
|
redirecting.from.number.presentation = pres;
|
|
|
|
redirecting.to.name.presentation = pres;
|
|
|
|
redirecting.to.number.presentation = pres;
|
|
|
|
set_it(chan, &redirecting, NULL);
|
|
|
|
}
|
|
|
|
} else if (member.argc == 1 && !strcasecmp("reason", member.argv[0])) {
|
|
|
|
int reason;
|
|
|
|
|
|
|
|
val = ast_strdupa(value);
|
|
|
|
ast_trim_blanks(val);
|
|
|
|
|
|
|
|
if (('0' <= val[0]) && (val[0] <= '9')) {
|
|
|
|
reason = atoi(val);
|
|
|
|
} else {
|
|
|
|
reason = ast_redirecting_reason_parse(val);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (reason < 0) {
|
2012-09-25 19:29:14 +00:00
|
|
|
/* The argument passed into the function does not correspond to a pre-defined
|
|
|
|
* reason, so we can just set the reason string to what was given and set the
|
|
|
|
* code to be unknown
|
|
|
|
*/
|
|
|
|
redirecting.reason.code = AST_REDIRECTING_REASON_UNKNOWN;
|
|
|
|
redirecting.reason.str = val;
|
|
|
|
set_it(chan, &redirecting, NULL);
|
2008-10-07 02:02:39 +00:00
|
|
|
} else {
|
2012-09-25 19:29:14 +00:00
|
|
|
redirecting.reason.code = reason;
|
|
|
|
redirecting.reason.str = "";
|
2010-07-14 15:48:36 +00:00
|
|
|
set_it(chan, &redirecting, NULL);
|
2008-10-07 02:02:39 +00:00
|
|
|
}
|
2010-07-14 15:48:36 +00:00
|
|
|
} else if (member.argc == 1 && !strcasecmp("count", member.argv[0])) {
|
|
|
|
val = ast_strdupa(value);
|
|
|
|
ast_trim_blanks(val);
|
2006-10-07 14:45:49 +00:00
|
|
|
|
2010-07-14 15:48:36 +00:00
|
|
|
if (('0' <= val[0]) && (val[0] <= '9')) {
|
|
|
|
redirecting.count = atoi(val);
|
|
|
|
set_it(chan, &redirecting, NULL);
|
2008-10-07 02:02:39 +00:00
|
|
|
} else {
|
2010-07-14 15:48:36 +00:00
|
|
|
ast_log(LOG_ERROR, "Unknown redirecting count '%s', value unchanged\n", val);
|
2008-10-07 02:02:39 +00:00
|
|
|
}
|
Add private representation of caller, connected and redirecting party ids.
This patch adds the feature "Private representation of caller, connected
and redirecting party ids", as previously discussed with us (DATUS) and
Digium.
1. Feature motivation
Until now it is quite difficult to modify a party number or name which can
only be seen by exactly one particular instantiated technology channel
subscriber. One example where a modified party number or name on one
channel is spread over several channels are supplementary services like
call transfer or pickup. To implement these features Asterisk internally
copies caller and connected ids from one channel to another. Another
example are extension subscriptions. The monitoring entities (watchers)
are notified of state changes and - if desired - of party numbers or names
which represent the involving call parties. One major feature where a
private representation of party names is essentially needed, i.e. where a
party name shall be exclusively signaled to only one particular user, is a
private user-specific name resolution for party numbers. A lookup in a
private destination-dependent telephone book shall provide party names
which cannot be seen by any other user at any time.
2. Feature Description
This feature comes along with the implementation of additional private
party id elements for caller id, connected id and redirecting ids inside
Asterisk channels.
The private party id elements can be read or set by the user using
Asterisk dialplan functions.
When a technology channel is initiating a call, receives an internal
connected-line update event, or receives an internal redirecting update
event, it merges the corresponding public id with the private id to create
an effective party id. The effective party id is then used for protocol
signaling.
The channel technologies which initially support the private id
representation with this patch are SIP (chan_sip), mISDN (chan_misdn) and
PRI (chan_dahdi).
Once a private name or number on a channel is set and (implicitly) made
valid, it is generally used for any further protocol signaling until it is
rewritten or invalidated.
To simplify the invalidation of private ids all internally generated
connected/redirecting update events and also all connected/redirecting
update events which are generated by technology channels -- receiving
regarding protocol information - automatically trigger the invalidation of
private ids.
If not using the private party id representation feature at all, i.e. if
using only the 'regular' caller-id, connected and redirecting related
functions, the current characteristic of Asterisk is not affected by the
new extended functionality.
3. User interface Description
To grant access to the private name and number representation from the
Asterisk dialplan, the CALLERID, CONNECTEDLINE and REDIRECTING dialplan
functions are extended by the following data types. The formats of these
data types are equal to the corresponding regular 'non-private' already
existing data types:
CALLERID:
priv-all
priv-name priv-name-valid priv-name-charset priv-name-pres
priv-num priv-num-valid priv-num-plan priv-num-pres
priv-subaddr priv-subaddr-valid priv-subaddr-type priv-subaddr-odd
priv-tag
CONNECTEDLINE:
priv-name priv-name-valid priv-name-pres priv-name-charset
priv-num priv-num-valid priv-num-pres priv-num-plan
priv-subaddr priv-subaddr-valid priv-subaddr-type priv-subaddr-odd
priv-tag
REDIRECTING:
priv-orig-name priv-orig-name-valid priv-orig-name-pres priv-orig-name-charset
priv-orig-num priv-orig-num-valid priv-orig-num-pres priv-orig-num-plan
priv-orig-subaddr priv-orig-subaddr-valid priv-orig-subaddr-type priv-orig-subaddr-odd
priv-orig-tag
priv-from-name priv-from-name-valid priv-from-name-pres priv-from-name-charset
priv-from-num priv-from-num-valid priv-from-num-pres priv-from-num-plan
priv-from-subaddr priv-from-subaddr-valid priv-from-subaddr-type priv-from-subaddr-odd
priv-from-tag
priv-to-name priv-to-name-valid priv-to-name-pres priv-to-name-charset
priv-to-num priv-to-num-valid priv-to-num-pres priv-to-num-plan
priv-to-subaddr priv-to-subaddr-valid priv-to-subaddr-type priv-to-subaddr-odd
priv-to-tag
Reported by: Thomas Arimont
Review: https://reviewboard.asterisk.org/r/2030/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@371120 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-10 19:54:55 +00:00
|
|
|
} else if (1 < member.argc && !strcasecmp("priv", member.argv[0])) {
|
|
|
|
if (!strcasecmp("orig", member.argv[1])) {
|
|
|
|
status = party_id_write(&redirecting.priv_orig, member.argc - 2, member.argv + 2,
|
|
|
|
value);
|
|
|
|
switch (status) {
|
|
|
|
case ID_FIELD_VALID:
|
|
|
|
set_it(chan, &redirecting, NULL);
|
|
|
|
break;
|
|
|
|
case ID_FIELD_INVALID:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
ast_party_redirecting_free(&redirecting);
|
|
|
|
} else if (!strcasecmp("from", member.argv[1])) {
|
|
|
|
status = party_id_write(&redirecting.priv_from, member.argc - 2, member.argv + 2,
|
|
|
|
value);
|
|
|
|
switch (status) {
|
|
|
|
case ID_FIELD_VALID:
|
|
|
|
set_it(chan, &redirecting, NULL);
|
|
|
|
break;
|
|
|
|
case ID_FIELD_INVALID:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
ast_party_redirecting_free(&redirecting);
|
|
|
|
} else if (!strcasecmp("to", member.argv[1])) {
|
|
|
|
status = party_id_write(&redirecting.priv_to, member.argc - 2, member.argv + 2, value);
|
|
|
|
switch (status) {
|
|
|
|
case ID_FIELD_VALID:
|
|
|
|
set_it(chan, &redirecting, NULL);
|
|
|
|
break;
|
|
|
|
case ID_FIELD_INVALID:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
ast_party_redirecting_free(&redirecting);
|
|
|
|
} else {
|
|
|
|
ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
|
|
|
|
}
|
2006-02-12 04:28:58 +00:00
|
|
|
} else {
|
2010-07-14 15:48:36 +00:00
|
|
|
ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
|
2006-02-12 04:28:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
2005-05-15 17:45:30 +00:00
|
|
|
}
|
|
|
|
|
2006-02-11 03:14:05 +00:00
|
|
|
static struct ast_custom_function callerid_function = {
|
2005-05-15 17:45:30 +00:00
|
|
|
.name = "CALLERID",
|
|
|
|
.read = callerid_read,
|
2009-04-29 18:53:01 +00:00
|
|
|
.read_max = 256,
|
2005-05-15 17:45:30 +00:00
|
|
|
.write = callerid_write,
|
|
|
|
};
|
|
|
|
|
2007-02-03 22:05:02 +00:00
|
|
|
static struct ast_custom_function callerpres_function = {
|
|
|
|
.name = "CALLERPRES",
|
|
|
|
.read = callerpres_read,
|
2009-04-29 18:53:01 +00:00
|
|
|
.read_max = 50,
|
2007-02-03 22:05:02 +00:00
|
|
|
.write = callerpres_write,
|
|
|
|
};
|
|
|
|
|
2010-07-14 15:48:36 +00:00
|
|
|
static struct ast_custom_function connectedline_function = {
|
|
|
|
.name = "CONNECTEDLINE",
|
|
|
|
.read = connectedline_read,
|
|
|
|
.write = connectedline_write,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct ast_custom_function redirecting_function = {
|
|
|
|
.name = "REDIRECTING",
|
|
|
|
.read = redirecting_read,
|
|
|
|
.write = redirecting_write,
|
|
|
|
};
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Unload the function module
|
|
|
|
*
|
|
|
|
* \retval 0 on success.
|
|
|
|
* \retval -1 on error.
|
|
|
|
*/
|
2006-08-21 02:11:39 +00:00
|
|
|
static int unload_module(void)
|
2005-05-15 17:45:30 +00:00
|
|
|
{
|
2010-07-14 15:48:36 +00:00
|
|
|
int res;
|
|
|
|
|
|
|
|
res = ast_custom_function_unregister(&callerpres_function);
|
2007-02-03 22:05:02 +00:00
|
|
|
res |= ast_custom_function_unregister(&callerid_function);
|
2010-07-14 15:48:36 +00:00
|
|
|
res |= ast_custom_function_unregister(&connectedline_function);
|
|
|
|
res |= ast_custom_function_unregister(&redirecting_function);
|
2007-02-03 22:05:02 +00:00
|
|
|
return res;
|
2005-05-15 17:45:30 +00:00
|
|
|
}
|
|
|
|
|
2010-07-14 15:48:36 +00:00
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Load and initialize the function module.
|
|
|
|
*
|
|
|
|
* \retval AST_MODULE_LOAD_SUCCESS on success.
|
|
|
|
* \retval AST_MODULE_LOAD_DECLINE on error.
|
|
|
|
*/
|
2006-08-21 02:11:39 +00:00
|
|
|
static int load_module(void)
|
2005-05-15 17:45:30 +00:00
|
|
|
{
|
2010-07-14 15:48:36 +00:00
|
|
|
int res;
|
|
|
|
|
|
|
|
res = ast_custom_function_register(&callerpres_function);
|
2007-02-03 22:05:02 +00:00
|
|
|
res |= ast_custom_function_register(&callerid_function);
|
2010-07-14 15:48:36 +00:00
|
|
|
res |= ast_custom_function_register(&connectedline_function);
|
|
|
|
res |= ast_custom_function_register(&redirecting_function);
|
|
|
|
return res ? AST_MODULE_LOAD_DECLINE : AST_MODULE_LOAD_SUCCESS;
|
2005-05-15 17:45:30 +00:00
|
|
|
}
|
|
|
|
|
2010-07-14 15:48:36 +00:00
|
|
|
/* Do not wrap the following line. */
|
|
|
|
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Party ID related dialplan functions (Caller-ID, Connected-line, Redirecting)");
|