[asterisk-dev] [Code Review] ast_callerid restructuring

rmudgett at digium.com rmudgett at digium.com
Tue Jun 15 10:40:41 CDT 2010


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/702/
-----------------------------------------------------------

(Updated 2010-06-15 10:40:41.551663)


Review request for Asterisk Developers and Mark Michelson.


Changes
-------

Update diff for current review comments and conflict resolution change.


Summary
-------

The purpose of this patch is to eliminate struct ast_callerid since it has
turned into a miscellaneous collection of various party information.

Eliminate struct ast_callerid and replace it with the following struct
organization:

struct ast_party_name {
	char *str;
	int char_set;
	int presentation;
	unsigned char valid;
};
struct ast_party_number {
	char *str;
	int plan;
	int presentation;
	unsigned char valid;
};
struct ast_party_subaddress {
	char *str;
	int type;
	unsigned char odd_even_indicator;
	unsigned char valid;
};
struct ast_party_id {
	struct ast_party_name name;
	struct ast_party_number number;
	struct ast_party_subaddress subaddress;
	char *tag;
};
struct ast_party_dialed {
	struct {
		char *str;
		int plan;
	} number;
	struct ast_party_subaddress subaddress;
	int transit_network_select;
};
struct ast_party_caller {
	struct ast_party_id id;
	char *ani;
	int ani2;
};

Note that the "XXX_" prepended to the name and number members in
ast_party_id in the diff are to ensure that all code has been converted
and will be renamed when committed.


The new organization adds some new information as well.

* The party name and number now have their own presentation value that can
be manipulated independently.  ISDN supplies the presentation value for
the name and number at different times with the possibility that they
could be different.

* The party name and number now have a valid flag.  Before this change the
name or number string could be empty if the presentation were restricted.
Most channel drivers assume that the name or number is then simply not
available instead of indicating that the name or number was restricted.

* The party name now has a character set value.  SIP and Q.SIG have the
ability to indicate what character set a name string is using so it could
be presented properly.

* The dialed party now has a numbering plan value that could be useful to
have available.

The various channel drivers will need to be updated to support the new
core features as needed.  They have simply been converted to supply
current functionality at this time.


The following items of note were either corrected or enhanced:

* The CONNECTEDLINE() and REDIRECTING() dialplan functions were
consolidated into func_callerid.c to share party id handling code.

* CALLERPRES() is now deprecated because the name and number have their
own presentation values.

* Fixed app_alarmreceiver.c write_metadata().  The workstring[] could
contain garbage.  It also can only contain the caller id number so using
ast_callerid_parse() on it is silly.  There was also a typo in the
CALLERNAME if test.

* Fixed app_rpt.c using ast_callerid_parse() on the channel's caller id
number string.  ast_callerid_parse() alters the given buffer which in this
case is the channel's caller id number string.  Then using
ast_shrink_phone_number() could alter it even more.

* Fixed caller ID name and number memory leak in chan_usbradio.c.

* Fixed uninitialized char arrays cid_num[] and cid_name[] in
sig_analog.c.

* Protected access to a caller channel with lock in chan_sip.c.

* Clarified intent of code in app_meetme.c sla_ring_station() and
dial_trunk().  Also made save all caller ID data instead of just the name
and number strings.

* Simplified cdr.c set_one_cid().  It hand coded the ast_callerid_merge()
function.

* Corrected some weirdness with app_privacy.c's use of caller
presentation.


Diffs (updated)
-----

  /trunk/UPGRADE.txt 270500 
  /trunk/addons/chan_ooh323.c 270500 
  /trunk/apps/app_alarmreceiver.c 270500 
  /trunk/apps/app_amd.c 270500 
  /trunk/apps/app_dial.c 270500 
  /trunk/apps/app_directed_pickup.c 270500 
  /trunk/apps/app_disa.c 270500 
  /trunk/apps/app_dumpchan.c 270500 
  /trunk/apps/app_fax.c 270500 
  /trunk/apps/app_followme.c 270500 
  /trunk/apps/app_macro.c 270500 
  /trunk/apps/app_meetme.c 270500 
  /trunk/apps/app_minivm.c 270500 
  /trunk/apps/app_osplookup.c 270500 
  /trunk/apps/app_parkandannounce.c 270500 
  /trunk/apps/app_privacy.c 270500 
  /trunk/apps/app_queue.c 270500 
  /trunk/apps/app_readexten.c 270500 
  /trunk/apps/app_rpt.c 270500 
  /trunk/apps/app_setcallerid.c 270500 
  /trunk/apps/app_sms.c 270500 
  /trunk/apps/app_stack.c 270500 
  /trunk/apps/app_talkdetect.c 270500 
  /trunk/apps/app_voicemail.c 270500 
  /trunk/apps/app_while.c 270500 
  /trunk/apps/app_zapateller.c 270500 
  /trunk/channels/chan_agent.c 270500 
  /trunk/channels/chan_console.c 270500 
  /trunk/channels/chan_dahdi.c 270500 
  /trunk/channels/chan_gtalk.c 270500 
  /trunk/channels/chan_h323.c 270500 
  /trunk/channels/chan_iax2.c 270500 
  /trunk/channels/chan_jingle.c 270500 
  /trunk/channels/chan_local.c 270500 
  /trunk/channels/chan_mgcp.c 270500 
  /trunk/channels/chan_misdn.c 270500 
  /trunk/channels/chan_oss.c 270500 
  /trunk/channels/chan_phone.c 270500 
  /trunk/channels/chan_sip.c 270500 
  /trunk/channels/chan_skinny.c 270500 
  /trunk/channels/chan_unistim.c 270500 
  /trunk/channels/chan_usbradio.c 270500 
  /trunk/channels/chan_vpb.cc 270500 
  /trunk/channels/sig_analog.h 270500 
  /trunk/channels/sig_analog.c 270500 
  /trunk/channels/sig_pri.c 270500 
  /trunk/channels/sig_ss7.c 270500 
  /trunk/funcs/func_blacklist.c 270500 
  /trunk/funcs/func_callerid.c 270500 
  /trunk/funcs/func_connectedline.c 270500 
  /trunk/funcs/func_dialplan.c 270500 
  /trunk/funcs/func_redirecting.c 270500 
  /trunk/include/asterisk/callerid.h 270500 
  /trunk/include/asterisk/channel.h 270500 
  /trunk/main/app.c 270500 
  /trunk/main/callerid.c 270500 
  /trunk/main/ccss.c 270500 
  /trunk/main/cdr.c 270500 
  /trunk/main/cel.c 270500 
  /trunk/main/channel.c 270500 
  /trunk/main/cli.c 270500 
  /trunk/main/dial.c 270500 
  /trunk/main/features.c 270500 
  /trunk/main/file.c 270500 
  /trunk/main/manager.c 270500 
  /trunk/main/pbx.c 270500 
  /trunk/res/res_agi.c 270500 
  /trunk/res/snmp/agent.c 270500 
  /trunk/tests/test_substitution.c 270500 

Diff: https://reviewboard.asterisk.org/r/702/diff


Testing
-------

Compile testing.  SIP and ISDN Q.SIG calls with CONNECTEDLINE, REDIRECTING, and CALLERID values set and read.


Thanks,

rmudgett




More information about the asterisk-dev mailing list