[asterisk-dev] [asterisk-commits] rmudgett: trunk r274782 - /trunk/main/channel.c
Eliel Sardañons
eliels at gmail.com
Thu Jul 8 18:09:11 CDT 2010
Thanks!!
Eliel
On 08/07/2010, at 18:05, SVN commits to the Asterisk project <asterisk-commits at lists.digium.com> wrote:
> Author: rmudgett
> Date: Thu Jul 8 17:05:40 2010
> New Revision: 274782
>
> URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=274782
> Log:
> Generate a correct AstData string for ast_callerid.cid_ton
>
> Modified:
> trunk/main/channel.c
>
> Modified: trunk/main/channel.c
> URL: http://svnview.digium.com/svn/asterisk/trunk/main/channel.c?view=diff&rev=274782&r1=274781&r2=274782
> ==============================================================================
> --- trunk/main/channel.c (original)
> +++ trunk/main/channel.c Thu Jul 8 17:05:40 2010
> @@ -283,28 +283,52 @@
> ast_data_add_bool(tree, "DISABLE_WORKAROUNDS", ast_test_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS));
> }
>
> -static const char *callerid_ton2str(int ton)
> +static const char *party_number_ton2str(int ton)
> {
> #if defined(HAVE_PRI)
> - switch (ton) {
> + switch ((ton >> 4) & 0x07) {
> case PRI_TON_INTERNATIONAL:
> - return "International Number";
> + return "International";
> case PRI_TON_NATIONAL:
> - return "National Number";
> + return "National";
> case PRI_TON_NET_SPECIFIC:
> - return "Network Specific Number";
> + return "Network Specific";
> case PRI_TON_SUBSCRIBER:
> - return "Subscriber Number";
> + return "Subscriber";
> case PRI_TON_ABBREVIATED:
> - return "Abbreviated number";
> + return "Abbreviated";
> case PRI_TON_RESERVED:
> - return "Reserved Number";
> + return "Reserved";
> case PRI_TON_UNKNOWN:
> default:
> - return "Unknown Number Type";
> + break;
> }
> #endif /* defined(HAVE_PRI) */
> - return "";
> + return "Unknown";
> +}
> +
> +static const char *party_number_plan2str(int plan)
> +{
> +#if defined(HAVE_PRI)
> + switch (plan & 0x0F) {
> + default:
> + case PRI_NPI_UNKNOWN:
> + break;
> + case PRI_NPI_E163_E164:
> + return "Public";
> + case PRI_NPI_X121:
> + return "Data";
> + case PRI_NPI_F69:
> + return "Telex";
> + case PRI_NPI_NATIONAL:
> + return "National Standard";
> + case PRI_NPI_PRIVATE:
> + return "Private";
> + case PRI_NPI_RESERVED:
> + return "Reserved";
> + }
> +#endif /* defined(HAVE_PRI) */
> + return "Unknown";
> }
>
> int ast_channel_data_add_structure(struct ast_data *tree,
> @@ -313,6 +337,7 @@
> struct ast_channel *bc;
> struct ast_data *data_bridged, *data_cdr, *data_flags, *data_zones;
> struct ast_data *data_callerid, *enum_node, *data_softhangup;
> + char value_str[100];
>
> if (!tree) {
> return -1;
> @@ -404,7 +429,10 @@
> return -1;
> }
> ast_data_add_int(enum_node, "value", chan->cid.cid_ton);
> - ast_data_add_str(enum_node, "text", callerid_ton2str(chan->cid.cid_ton));
> + snprintf(value_str, sizeof(value_str), "TON: %s/Plan: %s",
> + party_number_ton2str(chan->cid.cid_ton),
> + party_number_plan2str(chan->cid.cid_ton));
> + ast_data_add_str(enum_node, "text", value_str);
>
> /* tone zone */
> if (chan->zone) {
>
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-commits mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-commits
More information about the asterisk-dev
mailing list