Review Board 1.7.16


Fix transcode_via_sln and increase utility of PLC

Review Request #622 - Created April 22, 2010 and submitted

Mark Michelson
/trunk
Reviewers
asterisk-dev
Asterisk
The problem here is a bit complex, so try to bear with me...

It was noticed by a Digium customer that generic PLC (as configured in
codecs.conf) did not appear to actually be having any sort of benefit when
packet loss was introduced on an RTP stream. I reproduced this issue myself
by streaming a file across an RTP stream and dropping approx. 5% of the
RTP packets. I saw no real difference between when PLC was enabled or disabled
when using wireshark to analyze the RTP streams.

After analyzing what was going on, it became clear that one of the problems
faced was that when running my tests, the translation paths were being set
up in such a way that PLC could not possibly work as expected. To illustrate,
if packets are lost on channel A's read stream, then we expect that PLC will
be applied to channel B's write stream. The problem is that generic PLC can
only be done when there is a translation path that moves from some codec to
SLINEAR. When I would run my tests, I found that every single time, read
and write translation paths would be set up on channel A instead of channel
B. There appeared to be no real way to predict which channel the translation
paths would be set up on.

This is where Kevin swooped in to let me know about the transcode_via_sln
option in asterisk.conf. It is supposed to work by placing a read translation
path on both channels from the channel's rawreadformat to SLINEAR. It also
will place a write translation path on both channels from SLINEAR to the
channel's rawwriteformat. Using this option allows one to predictably set up
translation paths on all channels. There are two problems with this, though.
First and foremost, the transcode_via_sln option did not appear to be working
properly when I was placing a SIP call between two endpoints which did not
share any common formats. Second, even if this option were to work, for PLC
to be applied, there had to be a write translation path that would go from
some format to SLINEAR. It would not work properly if the starting format
of translation was SLINEAR.

The one-line change presented in this review request in chan_sip.c fixed the
first issue for me. The problem was that in sip_request_call, the
jointcapability of the outbound channel was being set to the format passed to
sip_request_call. This is nativeformats of the inbound channel. Because of this,
when ast_channel_make_compatible was called by app_dial, both channels already
had compatibly read and write formats. Thus, no translation path was set up at
the time. My change is to set the jointcapability of the sip_pvt created during
sip_request_call to the intersection of the inbound channel's nativeformats and
the configured peer capability that we determined during the earlier call to
create_addr. Doing this got the translation paths set up as expected when using
transcode_via_sln.

The changes presented in channel.c fixed the second issue for me. First and
foremost, when Asterisk is started, we'll read codecs.conf to see the value of
the genericplc option. If this option is set, and ast_write is called for a
frame with no data, then we will attempt to fill in the missing samples for
the frame. The implementation uses a channel datastore for maintaining the
PLC state and for creating a buffer to store PLC samples in. Even when we
receive a frame with data, we'll call plc_rx so that the PLC state will have
knowledge of the previous voice frame, which it can use as a basis for when
it comes time to actually do a PLC fill-in.

So, reviewers, now I ask for your help. First off, there's the one line change
in chan_sip that I have put in. Is it right? By my logic it seems correct, but
I'm sure someone can tell me why it is not going to work. This is probably the
change I'm least concerned about, though. What concerns me much more is the
set of changes in channel.c. First off, am I even doing it right? When I run
tests, I can clearly see that when PLC is activated, I see a significant increase
in RTP traffic where I would expect it to be. However, in my humble opinion, the
audio sounds kind of crappy whenever the PLC fill-in is done. It sounds worse to
me than when no PLC is used at all. I need someone to review the logic I have used
to be sure that I'm not misusing anything. As far as I can see my pointer arithmetic
is correct, and my use of AST_FRIENDLY_OFFSET should be correct as well, but I'm
sure someone can point out somewhere where I've done something incorrectly.

As I was writing this review request up, I decided to give the code a test run under
valgrind, and I find that for some reason, calls to plc_rx are causing some invalid
reads. Apparently I'm reading past the end of a buffer somehow. I'll have to dig around
a bit to see why that is the case. If it's obvious to someone reviewing, speak up!

Finally, I have one other proposal that is not reflected in my code review. Since
without transcode_via_sln set, one cannot predict or control where a translation
path will be up, it seems to me that the current practice of using PLC only when
transcoding to SLINEAR is not useful. I recommend that once it has been determined
that the method used in this code review is correct and works as expected, then
the code in translate.c that invokes PLC should be removed.
I ran a test where I would place a call from my Polycom phone through one Asterisk box
to a second one. The second box would play back the demo-congrats file. I modified the
RTP code in the second box to drop approximately 5 percent of the outgoing packets. The
audio between the two Asterisk boxes was GSM. The audio between the Polycom phone and
Asterisk was ulaw.

I used wireshark on the first Asterisk box to analyze the RTP streams. I noticed an increase
from an average of 2650 packets on the path from the first Asterisk box to the Polycom to
an average of 2786 packets when PLC was enabled.

Changes between revision 3 and 5

1 2 3 4 5
1 2 3 4 5

  1. /trunk/channels/chan_sip.c: Loading...
  2. /trunk/include/asterisk/_private.h: Loading...
  3. /trunk/include/asterisk/options.h: Loading...
  4. /trunk/main/asterisk.c: Loading...
  5. /trunk/main/channel.c: Loading...
  6. /trunk/main/loader.c: Loading...
/trunk/channels/chan_sip.c
Diff Revision 3 Diff Revision 5
[20] 4738 lines
[+20] [+] static int create_addr_from_peer(struct sip_pvt *dialog, struct sip_peer *peer)
4739
	ast_string_field_set(dialog, fullcontact, peer->fullcontact);
4739
	ast_string_field_set(dialog, fullcontact, peer->fullcontact);
4740
	ast_string_field_set(dialog, accountcode, peer->accountcode);
4740
	ast_string_field_set(dialog, accountcode, peer->accountcode);
4741
	ast_string_field_set(dialog, context, peer->context);
4741
	ast_string_field_set(dialog, context, peer->context);
4742
	ast_string_field_set(dialog, cid_num, peer->cid_num);
4742
	ast_string_field_set(dialog, cid_num, peer->cid_num);
4743
	ast_string_field_set(dialog, cid_name, peer->cid_name);
4743
	ast_string_field_set(dialog, cid_name, peer->cid_name);

    
   
4744
	ast_string_field_set(dialog, cid_tag, peer->cid_tag);
4744
	ast_string_field_set(dialog, mwi_from, peer->mwi_from);
4745
	ast_string_field_set(dialog, mwi_from, peer->mwi_from);
4745
	ast_string_field_set(dialog, parkinglot, peer->parkinglot);
4746
	ast_string_field_set(dialog, parkinglot, peer->parkinglot);
4746
	ast_string_field_set(dialog, engine, peer->engine);
4747
	ast_string_field_set(dialog, engine, peer->engine);
4747
	ref_proxy(dialog, obproxy_get(dialog, peer));
4748
	ref_proxy(dialog, obproxy_get(dialog, peer));
4748
	dialog->callgroup = peer->callgroup;
4749
	dialog->callgroup = peer->callgroup;
[+20] [20] 1530 lines
[+20] [+] static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *title, const char *linkedid)
6279
		return NULL;
6280
		return NULL;
6280
	}
6281
	}
6281
	ast_channel_lock(tmp);
6282
	ast_channel_lock(tmp);
6282
	sip_pvt_lock(i);
6283
	sip_pvt_lock(i);
6283
	ast_channel_cc_params_init(tmp, i->cc_params);
6284
	ast_channel_cc_params_init(tmp, i->cc_params);

    
   
6285
	tmp->cid.cid_tag = ast_strdup(i->cid_tag);
6284
	ast_channel_unlock(tmp);
6286
	ast_channel_unlock(tmp);
6285

    
   
6287

   
6286
	tmp->tech = ( ast_test_flag(&i->flags[0], SIP_DTMF) == SIP_DTMF_INFO || ast_test_flag(&i->flags[0], SIP_DTMF) == SIP_DTMF_SHORTINFO) ?  &sip_tech_info : &sip_tech;
6288
	tmp->tech = ( ast_test_flag(&i->flags[0], SIP_DTMF) == SIP_DTMF_INFO || ast_test_flag(&i->flags[0], SIP_DTMF) == SIP_DTMF_SHORTINFO) ?  &sip_tech_info : &sip_tech;
6287

    
   
6289

   
6288
	/* Select our native format based on codec preference until we receive
6290
	/* Select our native format based on codec preference until we receive
[+20] [20] 7104 lines
[+20] [+] static int get_rdnis(struct sip_pvt *p, struct sip_request *oreq, char **name, char **number, int *reason)
13393
		params++;
13395
		params++;
13394
		while (*params == ';' || *params == ' ')
13396
		while (*params == ';' || *params == ' ')
13395
			params++;
13397
			params++;
13396
		/* Check if we have a reason parameter */
13398
		/* Check if we have a reason parameter */
13397
		if ((reason_param = strcasestr(params, "reason="))) {
13399
		if ((reason_param = strcasestr(params, "reason="))) {

    
   
13400
			char *end;
13398
			reason_param+=7;
13401
			reason_param+=7;

    
   
13402
			if ((end = strchr(reason_param, ';'))) {

    
   
13403
				*end = '\0';

    
   
13404
			}
13399
			/* Remove enclosing double-quotes */
13405
			/* Remove enclosing double-quotes */
13400
			if (*reason_param == '"')
13406
			if (*reason_param == '"')
13401
				ast_strip_quoted(reason_param, "\"", "\"");
13407
				ast_strip_quoted(reason_param, "\"", "\"");
13402
			if (!ast_strlen_zero(reason_param)) {
13408
			if (!ast_strlen_zero(reason_param)) {
13403
				sip_set_redirstr(p, reason_param);
13409
				sip_set_redirstr(p, reason_param);
[+20] [20] 712 lines
[+20] [+] static enum check_auth_result check_peer_ok(struct sip_pvt *p, char *of,
14116
					ast_shrink_phone_number(tmp);
14122
					ast_shrink_phone_number(tmp);
14117
				ast_string_field_set(p, cid_num, tmp);
14123
				ast_string_field_set(p, cid_num, tmp);
14118
			}
14124
			}
14119
			if (!ast_strlen_zero(peer->cid_name))
14125
			if (!ast_strlen_zero(peer->cid_name))
14120
				ast_string_field_set(p, cid_name, peer->cid_name);
14126
				ast_string_field_set(p, cid_name, peer->cid_name);

    
   
14127
			if (!ast_strlen_zero(peer->cid_tag))

    
   
14128
				ast_string_field_set(p, cid_tag, peer->cid_tag);
14121
			if (peer->callingpres)
14129
			if (peer->callingpres)
14122
				p->callingpres = peer->callingpres;
14130
				p->callingpres = peer->callingpres;
14123
		}
14131
		}
14124
		ast_string_field_set(p, fullcontact, peer->fullcontact);
14132
		ast_string_field_set(p, fullcontact, peer->fullcontact);
14125
		if (!ast_strlen_zero(peer->context))
14133
		if (!ast_strlen_zero(peer->context))
[+20] [20] 358 lines
[+20] [+] static int peer_status(struct sip_peer *peer, char *status, int statuslen)
14484
		res = -1;
14492
		res = -1;
14485
	}
14493
	}
14486
	return res;
14494
	return res;
14487
}
14495
}
14488

    
   
14496

   
14489
/*! \brief return Yes or No depending on the argument.

   
14490
 * This is used in many places in CLI command, having a function to generate

   
14491
 * this helps maintaining a consistent output (and possibly emitting the

   
14492
 * output in other languages, at some point).

   
14493
 */

   
14494
static const char *cli_yesno(int x)

   
14495
{

   
14496
	return x ? "Yes" : "No";

   
14497
}

   
14498

    
   

   
14499
/*! \brief  Show active TCP connections */
14497
/*! \brief  Show active TCP connections */
14500
static char *sip_show_tcp(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
14498
static char *sip_show_tcp(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
14501
{
14499
{
14502
	struct sip_threadinfo *th;
14500
	struct sip_threadinfo *th;
14503
	struct ao2_iterator i;
14501
	struct ao2_iterator i;
[+20] [20] 87 lines
[+20] [+] static char *sip_show_users(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
14591

    
   
14589

   
14592
		ast_cli(a->fd, FORMAT, user->name,
14590
		ast_cli(a->fd, FORMAT, user->name,
14593
			user->secret,
14591
			user->secret,
14594
			user->accountcode,
14592
			user->accountcode,
14595
			user->context,
14593
			user->context,
14596
			cli_yesno(user->ha != NULL),
14594
			AST_CLI_YESNO(user->ha != NULL),
14597
			cli_yesno(ast_test_flag(&user->flags[0], SIP_NAT_FORCE_RPORT)));
14595
			AST_CLI_YESNO(ast_test_flag(&user->flags[0], SIP_NAT_FORCE_RPORT)));
14598
		ao2_unlock(user);
14596
		ao2_unlock(user);
14599
		unref_peer(user, "sip show users");
14597
		unref_peer(user, "sip show users");
14600
	}
14598
	}
14601
	ao2_iterator_destroy(&user_iter);
14599
	ao2_iterator_destroy(&user_iter);
14602

    
   
14600

   
[+20] [20] 858 lines
[+20] [+] static char *_sip_show_peer(int type, int fd, struct mansession *s, const struct message *m, int argc, const char *argv[])
15461
		ast_cli(fd, "  VM Extension : %s\n", peer->vmexten);
15459
		ast_cli(fd, "  VM Extension : %s\n", peer->vmexten);
15462
		ast_cli(fd, "  LastMsgsSent : %d/%d\n", (peer->lastmsgssent & 0x7fff0000) >> 16, peer->lastmsgssent & 0xffff);
15460
		ast_cli(fd, "  LastMsgsSent : %d/%d\n", (peer->lastmsgssent & 0x7fff0000) >> 16, peer->lastmsgssent & 0xffff);
15463
		ast_cli(fd, "  Call limit   : %d\n", peer->call_limit);
15461
		ast_cli(fd, "  Call limit   : %d\n", peer->call_limit);
15464
		if (peer->busy_level)
15462
		if (peer->busy_level)
15465
			ast_cli(fd, "  Busy level   : %d\n", peer->busy_level);
15463
			ast_cli(fd, "  Busy level   : %d\n", peer->busy_level);
15466
		ast_cli(fd, "  Dynamic      : %s\n", cli_yesno(peer->host_dynamic));
15464
		ast_cli(fd, "  Dynamic      : %s\n", AST_CLI_YESNO(peer->host_dynamic));
15467
		ast_cli(fd, "  Callerid     : %s\n", ast_callerid_merge(cbuf, sizeof(cbuf), peer->cid_name, peer->cid_num, "<unspecified>"));
15465
		ast_cli(fd, "  Callerid     : %s\n", ast_callerid_merge(cbuf, sizeof(cbuf), peer->cid_name, peer->cid_num, "<unspecified>"));
15468
		ast_cli(fd, "  MaxCallBR    : %d kbps\n", peer->maxcallbitrate);
15466
		ast_cli(fd, "  MaxCallBR    : %d kbps\n", peer->maxcallbitrate);
15469
		ast_cli(fd, "  Expire       : %ld\n", ast_sched_when(sched, peer->expire));
15467
		ast_cli(fd, "  Expire       : %ld\n", ast_sched_when(sched, peer->expire));
15470
		ast_cli(fd, "  Insecure     : %s\n", insecure2str(ast_test_flag(&peer->flags[0], SIP_INSECURE)));
15468
		ast_cli(fd, "  Insecure     : %s\n", insecure2str(ast_test_flag(&peer->flags[0], SIP_INSECURE)));
15471
		ast_cli(fd, "  Force rport  : %s\n", cli_yesno(ast_test_flag(&peer->flags[0], SIP_NAT_FORCE_RPORT)));
15469
		ast_cli(fd, "  Force rport  : %s\n", AST_CLI_YESNO(ast_test_flag(&peer->flags[0], SIP_NAT_FORCE_RPORT)));
15472
		ast_cli(fd, "  ACL          : %s\n", cli_yesno(peer->ha != NULL));
15470
		ast_cli(fd, "  ACL          : %s\n", AST_CLI_YESNO(peer->ha != NULL));
15473
		ast_cli(fd, "  T.38 support : %s\n", cli_yesno(ast_test_flag(&peer->flags[1], SIP_PAGE2_T38SUPPORT)));
15471
		ast_cli(fd, "  T.38 support : %s\n", AST_CLI_YESNO(ast_test_flag(&peer->flags[1], SIP_PAGE2_T38SUPPORT)));
15474
		ast_cli(fd, "  T.38 EC mode : %s\n", faxec2str(ast_test_flag(&peer->flags[1], SIP_PAGE2_T38SUPPORT)));
15472
		ast_cli(fd, "  T.38 EC mode : %s\n", faxec2str(ast_test_flag(&peer->flags[1], SIP_PAGE2_T38SUPPORT)));
15475
		ast_cli(fd, "  T.38 MaxDtgrm: %d\n", peer->t38_maxdatagram);
15473
		ast_cli(fd, "  T.38 MaxDtgrm: %d\n", peer->t38_maxdatagram);
15476
		ast_cli(fd, "  DirectMedia  : %s\n", cli_yesno(ast_test_flag(&peer->flags[0], SIP_DIRECT_MEDIA)));
15474
		ast_cli(fd, "  DirectMedia  : %s\n", AST_CLI_YESNO(ast_test_flag(&peer->flags[0], SIP_DIRECT_MEDIA)));
15477
		ast_cli(fd, "  PromiscRedir : %s\n", cli_yesno(ast_test_flag(&peer->flags[0], SIP_PROMISCREDIR)));
15475
		ast_cli(fd, "  PromiscRedir : %s\n", AST_CLI_YESNO(ast_test_flag(&peer->flags[0], SIP_PROMISCREDIR)));
15478
		ast_cli(fd, "  User=Phone   : %s\n", cli_yesno(ast_test_flag(&peer->flags[0], SIP_USEREQPHONE)));
15476
		ast_cli(fd, "  User=Phone   : %s\n", AST_CLI_YESNO(ast_test_flag(&peer->flags[0], SIP_USEREQPHONE)));
15479
		ast_cli(fd, "  Video Support: %s\n", cli_yesno(ast_test_flag(&peer->flags[1], SIP_PAGE2_VIDEOSUPPORT)));
15477
		ast_cli(fd, "  Video Support: %s\n", AST_CLI_YESNO(ast_test_flag(&peer->flags[1], SIP_PAGE2_VIDEOSUPPORT)));
15480
		ast_cli(fd, "  Text Support : %s\n", cli_yesno(ast_test_flag(&peer->flags[1], SIP_PAGE2_TEXTSUPPORT)));
15478
		ast_cli(fd, "  Text Support : %s\n", AST_CLI_YESNO(ast_test_flag(&peer->flags[1], SIP_PAGE2_TEXTSUPPORT)));
15481
		ast_cli(fd, "  Ign SDP ver  : %s\n", cli_yesno(ast_test_flag(&peer->flags[1], SIP_PAGE2_IGNORESDPVERSION)));
15479
		ast_cli(fd, "  Ign SDP ver  : %s\n", AST_CLI_YESNO(ast_test_flag(&peer->flags[1], SIP_PAGE2_IGNORESDPVERSION)));
15482
		ast_cli(fd, "  Trust RPID   : %s\n", cli_yesno(ast_test_flag(&peer->flags[0], SIP_TRUSTRPID)));
15480
		ast_cli(fd, "  Trust RPID   : %s\n", AST_CLI_YESNO(ast_test_flag(&peer->flags[0], SIP_TRUSTRPID)));
15483
		ast_cli(fd, "  Send RPID    : %s\n", cli_yesno(ast_test_flag(&peer->flags[0], SIP_SENDRPID)));
15481
		ast_cli(fd, "  Send RPID    : %s\n", AST_CLI_YESNO(ast_test_flag(&peer->flags[0], SIP_SENDRPID)));
15484
		ast_cli(fd, "  Subscriptions: %s\n", cli_yesno(ast_test_flag(&peer->flags[1], SIP_PAGE2_ALLOWSUBSCRIBE)));
15482
		ast_cli(fd, "  Subscriptions: %s\n", AST_CLI_YESNO(ast_test_flag(&peer->flags[1], SIP_PAGE2_ALLOWSUBSCRIBE)));
15485
		ast_cli(fd, "  Overlap dial : %s\n", cli_yesno(ast_test_flag(&peer->flags[1], SIP_PAGE2_ALLOWOVERLAP)));
15483
		ast_cli(fd, "  Overlap dial : %s\n", AST_CLI_YESNO(ast_test_flag(&peer->flags[1], SIP_PAGE2_ALLOWOVERLAP)));
15486
		if (peer->outboundproxy)
15484
		if (peer->outboundproxy)
15487
			ast_cli(fd, "  Outb. proxy  : %s %s\n", ast_strlen_zero(peer->outboundproxy->name) ? "<not set>" : peer->outboundproxy->name,
15485
			ast_cli(fd, "  Outb. proxy  : %s %s\n", ast_strlen_zero(peer->outboundproxy->name) ? "<not set>" : peer->outboundproxy->name,
15488
							peer->outboundproxy->force ? "(forced)" : "");
15486
							peer->outboundproxy->force ? "(forced)" : "");
15489

    
   
15487

   
15490
		/* - is enumerated */
15488
		/* - is enumerated */
[+20] [20] 27 lines
[+20] static char *_sip_show_peer(int type, int fd, struct mansession *s, const struct message *m, int argc, const char *argv[])
15518
		ast_cli(fd, "%s\n", codec_buf);
15516
		ast_cli(fd, "%s\n", codec_buf);
15519
		ast_cli(fd, "  Codec Order  : (");
15517
		ast_cli(fd, "  Codec Order  : (");
15520
		print_codec_to_cli(fd, &peer->prefs);
15518
		print_codec_to_cli(fd, &peer->prefs);
15521
		ast_cli(fd, ")\n");
15519
		ast_cli(fd, ")\n");
15522

    
   
15520

   
15523
		ast_cli(fd, "  Auto-Framing :  %s \n", cli_yesno(peer->autoframing));
15521
		ast_cli(fd, "  Auto-Framing :  %s \n", AST_CLI_YESNO(peer->autoframing));
15524
		ast_cli(fd, "  100 on REG   : %s\n", ast_test_flag(&peer->flags[1], SIP_PAGE2_REGISTERTRYING) ? "Yes" : "No");
15522
		ast_cli(fd, "  100 on REG   : %s\n", AST_CLI_YESNO(ast_test_flag(&peer->flags[1], SIP_PAGE2_REGISTERTRYING)));
15525
		ast_cli(fd, "  Status       : ");
15523
		ast_cli(fd, "  Status       : ");
15526
		peer_status(peer, status, sizeof(status));
15524
		peer_status(peer, status, sizeof(status));
15527
		ast_cli(fd, "%s\n", status);
15525
		ast_cli(fd, "%s\n", status);
15528
 		ast_cli(fd, "  Useragent    : %s\n", peer->useragent);
15526
 		ast_cli(fd, "  Useragent    : %s\n", peer->useragent);
15529
 		ast_cli(fd, "  Reg. Contact : %s\n", peer->fullcontact);
15527
 		ast_cli(fd, "  Reg. Contact : %s\n", peer->fullcontact);
[+20] [20] 8 lines
[+20] static char *_sip_show_peer(int type, int fd, struct mansession *s, const struct message *m, int argc, const char *argv[])
15538
		ast_cli(fd, "  Sess-Refresh : %s\n", strefresher2str(peer->stimer.st_ref));
15536
		ast_cli(fd, "  Sess-Refresh : %s\n", strefresher2str(peer->stimer.st_ref));
15539
		ast_cli(fd, "  Sess-Expires : %d secs\n", peer->stimer.st_max_se);
15537
		ast_cli(fd, "  Sess-Expires : %d secs\n", peer->stimer.st_max_se);
15540
		ast_cli(fd, "  Min-Sess     : %d secs\n", peer->stimer.st_min_se);
15538
		ast_cli(fd, "  Min-Sess     : %d secs\n", peer->stimer.st_min_se);
15541
		ast_cli(fd, "  RTP Engine   : %s\n", peer->engine);
15539
		ast_cli(fd, "  RTP Engine   : %s\n", peer->engine);
15542
		ast_cli(fd, "  Parkinglot   : %s\n", peer->parkinglot);
15540
		ast_cli(fd, "  Parkinglot   : %s\n", peer->parkinglot);
15543
		ast_cli(fd, "  Use Reason   : %s\n", ast_test_flag(&peer->flags[1], SIP_PAGE2_Q850_REASON) ? "Yes" : "No");
15541
		ast_cli(fd, "  Use Reason   : %s\n", AST_CLI_YESNO(ast_test_flag(&peer->flags[1], SIP_PAGE2_Q850_REASON)));
15544
		ast_cli(fd, "\n");
15542
		ast_cli(fd, "\n");
15545
		peer = unref_peer(peer, "sip_show_peer: unref_peer: done with peer ptr");
15543
		peer = unref_peer(peer, "sip_show_peer: unref_peer: done with peer ptr");
15546
	} else  if (peer && type == 1) { /* manager listing */
15544
	} else  if (peer && type == 1) { /* manager listing */
15547
		char buffer[256];
15545
		char buffer[256];
15548
		struct ast_str *mailbox_str = ast_str_alloca(512);
15546
		struct ast_str *mailbox_str = ast_str_alloca(512);
[+20] [20] 173 lines
[+20] [+] static char *sip_show_user(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
15722
		ast_cli(a->fd, "  Callgroup    : ");
15720
		ast_cli(a->fd, "  Callgroup    : ");
15723
		print_group(a->fd, user->callgroup, 0);
15721
		print_group(a->fd, user->callgroup, 0);
15724
		ast_cli(a->fd, "  Pickupgroup  : ");
15722
		ast_cli(a->fd, "  Pickupgroup  : ");
15725
		print_group(a->fd, user->pickupgroup, 0);
15723
		print_group(a->fd, user->pickupgroup, 0);
15726
		ast_cli(a->fd, "  Callerid     : %s\n", ast_callerid_merge(cbuf, sizeof(cbuf), user->cid_name, user->cid_num, "<unspecified>"));
15724
		ast_cli(a->fd, "  Callerid     : %s\n", ast_callerid_merge(cbuf, sizeof(cbuf), user->cid_name, user->cid_num, "<unspecified>"));
15727
		ast_cli(a->fd, "  ACL          : %s\n", cli_yesno(user->ha != NULL));
15725
		ast_cli(a->fd, "  ACL          : %s\n", AST_CLI_YESNO(user->ha != NULL));
15728
 		ast_cli(a->fd, "  Sess-Timers  : %s\n", stmode2str(user->stimer.st_mode_oper));
15726
 		ast_cli(a->fd, "  Sess-Timers  : %s\n", stmode2str(user->stimer.st_mode_oper));
15729
 		ast_cli(a->fd, "  Sess-Refresh : %s\n", strefresher2str(user->stimer.st_ref));
15727
 		ast_cli(a->fd, "  Sess-Refresh : %s\n", strefresher2str(user->stimer.st_ref));
15730
 		ast_cli(a->fd, "  Sess-Expires : %d secs\n", user->stimer.st_max_se);
15728
 		ast_cli(a->fd, "  Sess-Expires : %d secs\n", user->stimer.st_max_se);
15731
 		ast_cli(a->fd, "  Sess-Min-SE  : %d secs\n", user->stimer.st_min_se);
15729
 		ast_cli(a->fd, "  Sess-Min-SE  : %d secs\n", user->stimer.st_min_se);
15732
		ast_cli(a->fd, "  RTP Engine   : %s\n", user->engine);
15730
		ast_cli(a->fd, "  RTP Engine   : %s\n", user->engine);
15733

    
   
15731

   
15734
		ast_cli(a->fd, "  Codec Order  : (");
15732
		ast_cli(a->fd, "  Codec Order  : (");
15735
		print_codec_to_cli(a->fd, &user->prefs);
15733
		print_codec_to_cli(a->fd, &user->prefs);
15736
		ast_cli(a->fd, ")\n");
15734
		ast_cli(a->fd, ")\n");
15737

    
   
15735

   
15738
		ast_cli(a->fd, "  Auto-Framing:  %s \n", cli_yesno(user->autoframing));
15736
		ast_cli(a->fd, "  Auto-Framing:  %s \n", AST_CLI_YESNO(user->autoframing));
15739
		if (user->chanvars) {
15737
		if (user->chanvars) {
15740
 			ast_cli(a->fd, "  Variables    :\n");
15738
 			ast_cli(a->fd, "  Variables    :\n");
15741
			for (v = user->chanvars ; v ; v = v->next)
15739
			for (v = user->chanvars ; v ; v = v->next)
15742
 				ast_cli(a->fd, "                 %s = %s\n", v->name, v->value);
15740
 				ast_cli(a->fd, "                 %s = %s\n", v->name, v->value);
15743
		}
15741
		}
[+20] [20] 262 lines
[+20] [+] static char *sip_show_settings(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
16006
		ast_cli(a->fd, "%d\n", ntohs(sip_tls_desc.local_address.sin_port));
16004
		ast_cli(a->fd, "%d\n", ntohs(sip_tls_desc.local_address.sin_port));
16007
		ast_cli(a->fd, "  TLS Bindaddress:        %s\n", ast_inet_ntoa(sip_tls_desc.local_address.sin_addr));
16005
		ast_cli(a->fd, "  TLS Bindaddress:        %s\n", ast_inet_ntoa(sip_tls_desc.local_address.sin_addr));
16008
	} else {
16006
	} else {
16009
		ast_cli(a->fd, "Disabled\n");
16007
		ast_cli(a->fd, "Disabled\n");
16010
	}
16008
	}
16011
	ast_cli(a->fd, "  Videosupport:           %s\n", cli_yesno(ast_test_flag(&global_flags[1], SIP_PAGE2_VIDEOSUPPORT)));
16009
	ast_cli(a->fd, "  Videosupport:           %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[1], SIP_PAGE2_VIDEOSUPPORT)));
16012
	ast_cli(a->fd, "  Textsupport:            %s\n", cli_yesno(ast_test_flag(&global_flags[1], SIP_PAGE2_TEXTSUPPORT)));
16010
	ast_cli(a->fd, "  Textsupport:            %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[1], SIP_PAGE2_TEXTSUPPORT)));
16013
	ast_cli(a->fd, "  Ignore SDP sess. ver.:  %s\n", cli_yesno(ast_test_flag(&global_flags[1], SIP_PAGE2_IGNORESDPVERSION)));
16011
	ast_cli(a->fd, "  Ignore SDP sess. ver.:  %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[1], SIP_PAGE2_IGNORESDPVERSION)));
16014
	ast_cli(a->fd, "  AutoCreate Peer:        %s\n", cli_yesno(sip_cfg.autocreatepeer));
16012
	ast_cli(a->fd, "  AutoCreate Peer:        %s\n", AST_CLI_YESNO(sip_cfg.autocreatepeer));
16015
	ast_cli(a->fd, "  Match Auth Username:    %s\n", cli_yesno(global_match_auth_username));
16013
	ast_cli(a->fd, "  Match Auth Username:    %s\n", AST_CLI_YESNO(global_match_auth_username));
16016
	ast_cli(a->fd, "  Allow unknown access:   %s\n", cli_yesno(sip_cfg.allowguest));
16014
	ast_cli(a->fd, "  Allow unknown access:   %s\n", AST_CLI_YESNO(sip_cfg.allowguest));
16017
	ast_cli(a->fd, "  Allow subscriptions:    %s\n", cli_yesno(ast_test_flag(&global_flags[1], SIP_PAGE2_ALLOWSUBSCRIBE)));
16015
	ast_cli(a->fd, "  Allow subscriptions:    %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[1], SIP_PAGE2_ALLOWSUBSCRIBE)));
16018
	ast_cli(a->fd, "  Allow overlap dialing:  %s\n", cli_yesno(ast_test_flag(&global_flags[1], SIP_PAGE2_ALLOWOVERLAP)));
16016
	ast_cli(a->fd, "  Allow overlap dialing:  %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[1], SIP_PAGE2_ALLOWOVERLAP)));
16019
	ast_cli(a->fd, "  Allow promsic. redir:   %s\n", cli_yesno(ast_test_flag(&global_flags[0], SIP_PROMISCREDIR)));
16017
	ast_cli(a->fd, "  Allow promsic. redir:   %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[0], SIP_PROMISCREDIR)));
16020
	ast_cli(a->fd, "  Enable call counters:   %s\n", cli_yesno(global_callcounter));
16018
	ast_cli(a->fd, "  Enable call counters:   %s\n", AST_CLI_YESNO(global_callcounter));
16021
	ast_cli(a->fd, "  SIP domain support:     %s\n", cli_yesno(!AST_LIST_EMPTY(&domain_list)));
16019
	ast_cli(a->fd, "  SIP domain support:     %s\n", AST_CLI_YESNO(!AST_LIST_EMPTY(&domain_list)));
16022
	ast_cli(a->fd, "  Realm. auth:            %s\n", cli_yesno(authl != NULL));
16020
	ast_cli(a->fd, "  Realm. auth:            %s\n", AST_CLI_YESNO(authl != NULL));
16023
	ast_cli(a->fd, "  Our auth realm          %s\n", sip_cfg.realm);
16021
	ast_cli(a->fd, "  Our auth realm          %s\n", sip_cfg.realm);
16024
	ast_cli(a->fd, "  Use domains as realms:  %s\n", cli_yesno(sip_cfg.domainsasrealm));
16022
	ast_cli(a->fd, "  Use domains as realms:  %s\n", AST_CLI_YESNO(sip_cfg.domainsasrealm));
16025
	ast_cli(a->fd, "  Call to non-local dom.: %s\n", cli_yesno(sip_cfg.allow_external_domains));
16023
	ast_cli(a->fd, "  Call to non-local dom.: %s\n", AST_CLI_YESNO(sip_cfg.allow_external_domains));
16026
	ast_cli(a->fd, "  URI user is phone no:   %s\n", cli_yesno(ast_test_flag(&global_flags[0], SIP_USEREQPHONE)));
16024
	ast_cli(a->fd, "  URI user is phone no:   %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[0], SIP_USEREQPHONE)));
16027
 	ast_cli(a->fd, "  Always auth rejects:    %s\n", cli_yesno(sip_cfg.alwaysauthreject));
16025
 	ast_cli(a->fd, "  Always auth rejects:    %s\n", AST_CLI_YESNO(sip_cfg.alwaysauthreject));
16028
	ast_cli(a->fd, "  Direct RTP setup:       %s\n", cli_yesno(sip_cfg.directrtpsetup));
16026
	ast_cli(a->fd, "  Direct RTP setup:       %s\n", AST_CLI_YESNO(sip_cfg.directrtpsetup));
16029
	ast_cli(a->fd, "  User Agent:             %s\n", global_useragent);
16027
	ast_cli(a->fd, "  User Agent:             %s\n", global_useragent);
16030
	ast_cli(a->fd, "  SDP Session Name:       %s\n", ast_strlen_zero(global_sdpsession) ? "-" : global_sdpsession);
16028
	ast_cli(a->fd, "  SDP Session Name:       %s\n", ast_strlen_zero(global_sdpsession) ? "-" : global_sdpsession);
16031
	ast_cli(a->fd, "  SDP Owner Name:         %s\n", ast_strlen_zero(global_sdpowner) ? "-" : global_sdpowner);
16029
	ast_cli(a->fd, "  SDP Owner Name:         %s\n", ast_strlen_zero(global_sdpowner) ? "-" : global_sdpowner);
16032
	ast_cli(a->fd, "  Reg. context:           %s\n", S_OR(sip_cfg.regcontext, "(not set)"));
16030
	ast_cli(a->fd, "  Reg. context:           %s\n", S_OR(sip_cfg.regcontext, "(not set)"));
16033
	ast_cli(a->fd, "  Regexten on Qualify:    %s\n", cli_yesno(sip_cfg.regextenonqualify));
16031
	ast_cli(a->fd, "  Regexten on Qualify:    %s\n", AST_CLI_YESNO(sip_cfg.regextenonqualify));
16034
	ast_cli(a->fd, "  Caller ID:              %s\n", default_callerid);
16032
	ast_cli(a->fd, "  Caller ID:              %s\n", default_callerid);
16035
	ast_cli(a->fd, "  From: Domain:           %s\n", default_fromdomain);
16033
	ast_cli(a->fd, "  From: Domain:           %s\n", default_fromdomain);
16036
	ast_cli(a->fd, "  Record SIP history:     %s\n", recordhistory ? "On" : "Off");
16034
	ast_cli(a->fd, "  Record SIP history:     %s\n", AST_CLI_ONOFF(recordhistory));
16037
	ast_cli(a->fd, "  Call Events:            %s\n", sip_cfg.callevents ? "On" : "Off");
16035
	ast_cli(a->fd, "  Call Events:            %s\n", AST_CLI_ONOFF(sip_cfg.callevents));
16038
	ast_cli(a->fd, "  Auth. Failure Events:   %s\n", global_authfailureevents ? "On" : "Off");
16036
	ast_cli(a->fd, "  Auth. Failure Events:   %s\n", AST_CLI_ONOFF(global_authfailureevents));
16039

    
   
16037

   
16040
	ast_cli(a->fd, "  T.38 support:           %s\n", cli_yesno(ast_test_flag(&global_flags[1], SIP_PAGE2_T38SUPPORT)));
16038
	ast_cli(a->fd, "  T.38 support:           %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[1], SIP_PAGE2_T38SUPPORT)));
16041
	ast_cli(a->fd, "  T.38 EC mode:           %s\n", faxec2str(ast_test_flag(&global_flags[1], SIP_PAGE2_T38SUPPORT)));
16039
	ast_cli(a->fd, "  T.38 EC mode:           %s\n", faxec2str(ast_test_flag(&global_flags[1], SIP_PAGE2_T38SUPPORT)));
16042
	ast_cli(a->fd, "  T.38 MaxDtgrm:          %d\n", global_t38_maxdatagram);
16040
	ast_cli(a->fd, "  T.38 MaxDtgrm:          %d\n", global_t38_maxdatagram);
16043
	if (!realtimepeers && !realtimeregs)
16041
	if (!realtimepeers && !realtimeregs)
16044
		ast_cli(a->fd, "  SIP realtime:           Disabled\n" );
16042
		ast_cli(a->fd, "  SIP realtime:           Disabled\n" );
16045
	else
16043
	else
16046
		ast_cli(a->fd, "  SIP realtime:           Enabled\n" );
16044
		ast_cli(a->fd, "  SIP realtime:           Enabled\n" );
16047
	ast_cli(a->fd, "  Qualify Freq :          %d ms\n", global_qualifyfreq);
16045
	ast_cli(a->fd, "  Qualify Freq :          %d ms\n", global_qualifyfreq);
16048
	ast_cli(a->fd, "  Q.850 Reason header:    %s\n", cli_yesno(ast_test_flag(&global_flags[1], SIP_PAGE2_Q850_REASON)));
16046
	ast_cli(a->fd, "  Q.850 Reason header:    %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[1], SIP_PAGE2_Q850_REASON)));
16049
	ast_cli(a->fd, "\nNetwork QoS Settings:\n");
16047
	ast_cli(a->fd, "\nNetwork QoS Settings:\n");
16050
	ast_cli(a->fd, "---------------------------\n");
16048
	ast_cli(a->fd, "---------------------------\n");
16051
	ast_cli(a->fd, "  IP ToS SIP:             %s\n", ast_tos2str(global_tos_sip));
16049
	ast_cli(a->fd, "  IP ToS SIP:             %s\n", ast_tos2str(global_tos_sip));
16052
	ast_cli(a->fd, "  IP ToS RTP audio:       %s\n", ast_tos2str(global_tos_audio));
16050
	ast_cli(a->fd, "  IP ToS RTP audio:       %s\n", ast_tos2str(global_tos_audio));
16053
	ast_cli(a->fd, "  IP ToS RTP video:       %s\n", ast_tos2str(global_tos_video));
16051
	ast_cli(a->fd, "  IP ToS RTP video:       %s\n", ast_tos2str(global_tos_video));
16054
	ast_cli(a->fd, "  IP ToS RTP text:        %s\n", ast_tos2str(global_tos_text));
16052
	ast_cli(a->fd, "  IP ToS RTP text:        %s\n", ast_tos2str(global_tos_text));
16055
	ast_cli(a->fd, "  802.1p CoS SIP:         %d\n", global_cos_sip);
16053
	ast_cli(a->fd, "  802.1p CoS SIP:         %d\n", global_cos_sip);
16056
	ast_cli(a->fd, "  802.1p CoS RTP audio:   %d\n", global_cos_audio);
16054
	ast_cli(a->fd, "  802.1p CoS RTP audio:   %d\n", global_cos_audio);
16057
	ast_cli(a->fd, "  802.1p CoS RTP video:   %d\n", global_cos_video);
16055
	ast_cli(a->fd, "  802.1p CoS RTP video:   %d\n", global_cos_video);
16058
	ast_cli(a->fd, "  802.1p CoS RTP text:    %d\n", global_cos_text);
16056
	ast_cli(a->fd, "  802.1p CoS RTP text:    %d\n", global_cos_text);
16059
	ast_cli(a->fd, "  Jitterbuffer enabled:   %s\n", cli_yesno(ast_test_flag(&global_jbconf, AST_JB_ENABLED)));
16057
	ast_cli(a->fd, "  Jitterbuffer enabled:   %s\n", AST_CLI_YESNO(ast_test_flag(&global_jbconf, AST_JB_ENABLED)));
16060
	ast_cli(a->fd, "  Jitterbuffer forced:    %s\n", cli_yesno(ast_test_flag(&global_jbconf, AST_JB_FORCED)));
16058
	ast_cli(a->fd, "  Jitterbuffer forced:    %s\n", AST_CLI_YESNO(ast_test_flag(&global_jbconf, AST_JB_FORCED)));
16061
	ast_cli(a->fd, "  Jitterbuffer max size:  %ld\n", global_jbconf.max_size);
16059
	ast_cli(a->fd, "  Jitterbuffer max size:  %ld\n", global_jbconf.max_size);
16062
	ast_cli(a->fd, "  Jitterbuffer resync:    %ld\n", global_jbconf.resync_threshold);
16060
	ast_cli(a->fd, "  Jitterbuffer resync:    %ld\n", global_jbconf.resync_threshold);
16063
	ast_cli(a->fd, "  Jitterbuffer impl:      %s\n", global_jbconf.impl);
16061
	ast_cli(a->fd, "  Jitterbuffer impl:      %s\n", global_jbconf.impl);
16064
	ast_cli(a->fd, "  Jitterbuffer log:       %s\n", cli_yesno(ast_test_flag(&global_jbconf, AST_JB_LOG)));
16062
	ast_cli(a->fd, "  Jitterbuffer log:       %s\n", AST_CLI_YESNO(ast_test_flag(&global_jbconf, AST_JB_LOG)));
16065

    
   
16063

   
16066
	ast_cli(a->fd, "\nNetwork Settings:\n");
16064
	ast_cli(a->fd, "\nNetwork Settings:\n");
16067
	ast_cli(a->fd, "---------------------------\n");
16065
	ast_cli(a->fd, "---------------------------\n");
16068
	/* determine if/how SIP address can be remapped */
16066
	/* determine if/how SIP address can be remapped */
16069
	if (localaddr == NULL)
16067
	if (localaddr == NULL)
[+20] [20] 30 lines
[+20] static char *sip_show_settings(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
16100
	ast_getformatname_multiple(codec_buf, sizeof(codec_buf) -1, sip_cfg.capability);
16098
	ast_getformatname_multiple(codec_buf, sizeof(codec_buf) -1, sip_cfg.capability);
16101
	ast_cli(a->fd, "%s\n", codec_buf);
16099
	ast_cli(a->fd, "%s\n", codec_buf);
16102
	ast_cli(a->fd, "  Codec Order:            ");
16100
	ast_cli(a->fd, "  Codec Order:            ");
16103
	print_codec_to_cli(a->fd, &default_prefs);
16101
	print_codec_to_cli(a->fd, &default_prefs);
16104
	ast_cli(a->fd, "\n");
16102
	ast_cli(a->fd, "\n");
16105
	ast_cli(a->fd, "  Relax DTMF:             %s\n", cli_yesno(global_relaxdtmf));
16103
	ast_cli(a->fd, "  Relax DTMF:             %s\n", AST_CLI_YESNO(global_relaxdtmf));
16106
	ast_cli(a->fd, "  RFC2833 Compensation:   %s\n", cli_yesno(ast_test_flag(&global_flags[1], SIP_PAGE2_RFC2833_COMPENSATE)));
16104
	ast_cli(a->fd, "  RFC2833 Compensation:   %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[1], SIP_PAGE2_RFC2833_COMPENSATE)));
16107
	ast_cli(a->fd, "  Symmetric RTP:          %s\n", cli_yesno(ast_test_flag(&global_flags[1], SIP_PAGE2_SYMMETRICRTP)));
16105
	ast_cli(a->fd, "  Symmetric RTP:          %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[1], SIP_PAGE2_SYMMETRICRTP)));
16108
	ast_cli(a->fd, "  Compact SIP headers:    %s\n", cli_yesno(sip_cfg.compactheaders));
16106
	ast_cli(a->fd, "  Compact SIP headers:    %s\n", AST_CLI_YESNO(sip_cfg.compactheaders));
16109
	ast_cli(a->fd, "  RTP Keepalive:          %d %s\n", global_rtpkeepalive, global_rtpkeepalive ? "" : "(Disabled)" );
16107
	ast_cli(a->fd, "  RTP Keepalive:          %d %s\n", global_rtpkeepalive, global_rtpkeepalive ? "" : "(Disabled)" );
16110
	ast_cli(a->fd, "  RTP Timeout:            %d %s\n", global_rtptimeout, global_rtptimeout ? "" : "(Disabled)" );
16108
	ast_cli(a->fd, "  RTP Timeout:            %d %s\n", global_rtptimeout, global_rtptimeout ? "" : "(Disabled)" );
16111
	ast_cli(a->fd, "  RTP Hold Timeout:       %d %s\n", global_rtpholdtimeout, global_rtpholdtimeout ? "" : "(Disabled)");
16109
	ast_cli(a->fd, "  RTP Hold Timeout:       %d %s\n", global_rtpholdtimeout, global_rtpholdtimeout ? "" : "(Disabled)");
16112
	ast_cli(a->fd, "  MWI NOTIFY mime type:   %s\n", default_notifymime);
16110
	ast_cli(a->fd, "  MWI NOTIFY mime type:   %s\n", default_notifymime);
16113
	ast_cli(a->fd, "  DNS SRV lookup:         %s\n", cli_yesno(sip_cfg.srvlookup));
16111
	ast_cli(a->fd, "  DNS SRV lookup:         %s\n", AST_CLI_YESNO(sip_cfg.srvlookup));
16114
	ast_cli(a->fd, "  Pedantic SIP support:   %s\n", cli_yesno(sip_cfg.pedanticsipchecking));
16112
	ast_cli(a->fd, "  Pedantic SIP support:   %s\n", AST_CLI_YESNO(sip_cfg.pedanticsipchecking));
16115
	ast_cli(a->fd, "  Reg. min duration       %d secs\n", min_expiry);
16113
	ast_cli(a->fd, "  Reg. min duration       %d secs\n", min_expiry);
16116
	ast_cli(a->fd, "  Reg. max duration:      %d secs\n", max_expiry);
16114
	ast_cli(a->fd, "  Reg. max duration:      %d secs\n", max_expiry);
16117
	ast_cli(a->fd, "  Reg. default duration:  %d secs\n", default_expiry);
16115
	ast_cli(a->fd, "  Reg. default duration:  %d secs\n", default_expiry);
16118
	ast_cli(a->fd, "  Outbound reg. timeout:  %d secs\n", global_reg_timeout);
16116
	ast_cli(a->fd, "  Outbound reg. timeout:  %d secs\n", global_reg_timeout);
16119
	ast_cli(a->fd, "  Outbound reg. attempts: %d\n", global_regattempts_max);
16117
	ast_cli(a->fd, "  Outbound reg. attempts: %d\n", global_regattempts_max);
16120
	ast_cli(a->fd, "  Notify ringing state:   %s\n", cli_yesno(sip_cfg.notifyringing));
16118
	ast_cli(a->fd, "  Notify ringing state:   %s\n", AST_CLI_YESNO(sip_cfg.notifyringing));
16121
	if (sip_cfg.notifyringing) {
16119
	if (sip_cfg.notifyringing) {
16122
		ast_cli(a->fd, "    Include CID:          %s%s\n",
16120
		ast_cli(a->fd, "    Include CID:          %s%s\n",
16123
				cli_yesno(sip_cfg.notifycid),
16121
				AST_CLI_YESNO(sip_cfg.notifycid),
16124
				sip_cfg.notifycid == IGNORE_CONTEXT ? " (Ignoring context)" : "");
16122
				sip_cfg.notifycid == IGNORE_CONTEXT ? " (Ignoring context)" : "");
16125
	}
16123
	}
16126
	ast_cli(a->fd, "  Notify hold state:      %s\n", cli_yesno(sip_cfg.notifyhold));
16124
	ast_cli(a->fd, "  Notify hold state:      %s\n", AST_CLI_YESNO(sip_cfg.notifyhold));
16127
	ast_cli(a->fd, "  SIP Transfer mode:      %s\n", transfermode2str(sip_cfg.allowtransfer));
16125
	ast_cli(a->fd, "  SIP Transfer mode:      %s\n", transfermode2str(sip_cfg.allowtransfer));
16128
	ast_cli(a->fd, "  Max Call Bitrate:       %d kbps\n", default_maxcallbitrate);
16126
	ast_cli(a->fd, "  Max Call Bitrate:       %d kbps\n", default_maxcallbitrate);
16129
	ast_cli(a->fd, "  Auto-Framing:           %s\n", cli_yesno(global_autoframing));
16127
	ast_cli(a->fd, "  Auto-Framing:           %s\n", AST_CLI_YESNO(global_autoframing));
16130
	ast_cli(a->fd, "  Outb. proxy:            %s %s\n", ast_strlen_zero(sip_cfg.outboundproxy.name) ? "<not set>" : sip_cfg.outboundproxy.name,
16128
	ast_cli(a->fd, "  Outb. proxy:            %s %s\n", ast_strlen_zero(sip_cfg.outboundproxy.name) ? "<not set>" : sip_cfg.outboundproxy.name,
16131
							sip_cfg.outboundproxy.force ? "(forced)" : "");
16129
							sip_cfg.outboundproxy.force ? "(forced)" : "");
16132
	ast_cli(a->fd, "  Session Timers:         %s\n", stmode2str(global_st_mode));
16130
	ast_cli(a->fd, "  Session Timers:         %s\n", stmode2str(global_st_mode));
16133
	ast_cli(a->fd, "  Session Refresher:      %s\n", strefresher2str (global_st_refresher));
16131
	ast_cli(a->fd, "  Session Refresher:      %s\n", strefresher2str (global_st_refresher));
16134
	ast_cli(a->fd, "  Session Expires:        %d secs\n", global_max_se);
16132
	ast_cli(a->fd, "  Session Expires:        %d secs\n", global_max_se);
16135
	ast_cli(a->fd, "  Session Min-SE:         %d secs\n", global_min_se);
16133
	ast_cli(a->fd, "  Session Min-SE:         %d secs\n", global_min_se);
16136
 	ast_cli(a->fd, "  Timer T1:               %d\n", global_t1);
16134
 	ast_cli(a->fd, "  Timer T1:               %d\n", global_t1);
16137
	ast_cli(a->fd, "  Timer T1 minimum:       %d\n", global_t1min);
16135
	ast_cli(a->fd, "  Timer T1 minimum:       %d\n", global_t1min);
16138
 	ast_cli(a->fd, "  Timer B:                %d\n", global_timer_b);
16136
 	ast_cli(a->fd, "  Timer B:                %d\n", global_timer_b);
16139
	ast_cli(a->fd, "  No premature media:     %s\n", global_prematuremediafilter ? "Yes" : "No");
16137
	ast_cli(a->fd, "  No premature media:     %s\n", AST_CLI_YESNO(global_prematuremediafilter));
16140

    
   
16138

   
16141
	ast_cli(a->fd, "\nDefault Settings:\n");
16139
	ast_cli(a->fd, "\nDefault Settings:\n");
16142
	ast_cli(a->fd, "-----------------\n");
16140
	ast_cli(a->fd, "-----------------\n");
16143
	ast_cli(a->fd, "  Allowed transports:     %s\n", get_transport_list(default_transports));
16141
	ast_cli(a->fd, "  Allowed transports:     %s\n", get_transport_list(default_transports));
16144
	ast_cli(a->fd, "  Outbound transport:	  %s\n", get_transport(default_primary_transport));
16142
	ast_cli(a->fd, "  Outbound transport:	  %s\n", get_transport(default_primary_transport));
16145
	ast_cli(a->fd, "  Context:                %s\n", sip_cfg.default_context);
16143
	ast_cli(a->fd, "  Context:                %s\n", sip_cfg.default_context);
16146
	ast_cli(a->fd, "  Force rport:            %s\n", cli_yesno(ast_test_flag(&global_flags[0], SIP_NAT_FORCE_RPORT)));
16144
	ast_cli(a->fd, "  Force rport:            %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[0], SIP_NAT_FORCE_RPORT)));
16147
	ast_cli(a->fd, "  DTMF:                   %s\n", dtmfmode2str(ast_test_flag(&global_flags[0], SIP_DTMF)));
16145
	ast_cli(a->fd, "  DTMF:                   %s\n", dtmfmode2str(ast_test_flag(&global_flags[0], SIP_DTMF)));
16148
	ast_cli(a->fd, "  Qualify:                %d\n", default_qualify);
16146
	ast_cli(a->fd, "  Qualify:                %d\n", default_qualify);
16149
	ast_cli(a->fd, "  Use ClientCode:         %s\n", cli_yesno(ast_test_flag(&global_flags[0], SIP_USECLIENTCODE)));
16147
	ast_cli(a->fd, "  Use ClientCode:         %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[0], SIP_USECLIENTCODE)));
16150
	ast_cli(a->fd, "  Progress inband:        %s\n", (ast_test_flag(&global_flags[0], SIP_PROG_INBAND) == SIP_PROG_INBAND_NEVER) ? "Never" : (ast_test_flag(&global_flags[0], SIP_PROG_INBAND) == SIP_PROG_INBAND_NO) ? "No" : "Yes" );
16148
	ast_cli(a->fd, "  Progress inband:        %s\n", (ast_test_flag(&global_flags[0], SIP_PROG_INBAND) == SIP_PROG_INBAND_NEVER) ? "Never" : (AST_CLI_YESNO(ast_test_flag(&global_flags[0], SIP_PROG_INBAND) != SIP_PROG_INBAND_NO)));
16151
	ast_cli(a->fd, "  Language:               %s\n", default_language);
16149
	ast_cli(a->fd, "  Language:               %s\n", default_language);
16152
	ast_cli(a->fd, "  MOH Interpret:          %s\n", default_mohinterpret);
16150
	ast_cli(a->fd, "  MOH Interpret:          %s\n", default_mohinterpret);
16153
	ast_cli(a->fd, "  MOH Suggest:            %s\n", default_mohsuggest);
16151
	ast_cli(a->fd, "  MOH Suggest:            %s\n", default_mohsuggest);
16154
	ast_cli(a->fd, "  Voice Mail Extension:   %s\n", default_vmexten);
16152
	ast_cli(a->fd, "  Voice Mail Extension:   %s\n", default_vmexten);
16155

    
   
16153

   
16156
	
16154
	
16157
	if (realtimepeers || realtimeregs) {
16155
	if (realtimepeers || realtimeregs) {
16158
		ast_cli(a->fd, "\nRealtime SIP Settings:\n");
16156
		ast_cli(a->fd, "\nRealtime SIP Settings:\n");
16159
		ast_cli(a->fd, "----------------------\n");
16157
		ast_cli(a->fd, "----------------------\n");
16160
		ast_cli(a->fd, "  Realtime Peers:         %s\n", cli_yesno(realtimepeers));
16158
		ast_cli(a->fd, "  Realtime Peers:         %s\n", AST_CLI_YESNO(realtimepeers));
16161
		ast_cli(a->fd, "  Realtime Regs:          %s\n", cli_yesno(realtimeregs));
16159
		ast_cli(a->fd, "  Realtime Regs:          %s\n", AST_CLI_YESNO(realtimeregs));
16162
		ast_cli(a->fd, "  Cache Friends:          %s\n", cli_yesno(ast_test_flag(&global_flags[1], SIP_PAGE2_RTCACHEFRIENDS)));
16160
		ast_cli(a->fd, "  Cache Friends:          %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[1], SIP_PAGE2_RTCACHEFRIENDS)));
16163
		ast_cli(a->fd, "  Update:                 %s\n", cli_yesno(sip_cfg.peer_rtupdate));
16161
		ast_cli(a->fd, "  Update:                 %s\n", AST_CLI_YESNO(sip_cfg.peer_rtupdate));
16164
		ast_cli(a->fd, "  Ignore Reg. Expire:     %s\n", cli_yesno(sip_cfg.ignore_regexpire));
16162
		ast_cli(a->fd, "  Ignore Reg. Expire:     %s\n", AST_CLI_YESNO(sip_cfg.ignore_regexpire));
16165
		ast_cli(a->fd, "  Save sys. name:         %s\n", cli_yesno(sip_cfg.rtsave_sysname));
16163
		ast_cli(a->fd, "  Save sys. name:         %s\n", AST_CLI_YESNO(sip_cfg.rtsave_sysname));
16166
		ast_cli(a->fd, "  Auto Clear:             %d\n", sip_cfg.rtautoclear);
16164
		ast_cli(a->fd, "  Auto Clear:             %d\n", sip_cfg.rtautoclear);
16167
	}
16165
	}
16168
	ast_cli(a->fd, "\n----\n");
16166
	ast_cli(a->fd, "\n----\n");
16169
	return CLI_SUCCESS;
16167
	return CLI_SUCCESS;
16170
}
16168
}
[+20] [20] 17 lines
[+20] [+] static char *sip_show_mwi(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
16188
	ast_cli(a->fd, FORMAT, "Host", "Username", "Mailbox", "Subscribed");
16186
	ast_cli(a->fd, FORMAT, "Host", "Username", "Mailbox", "Subscribed");
16189
	
16187
	
16190
	ASTOBJ_CONTAINER_TRAVERSE(&submwil, 1, do {
16188
	ASTOBJ_CONTAINER_TRAVERSE(&submwil, 1, do {
16191
		ASTOBJ_RDLOCK(iterator);
16189
		ASTOBJ_RDLOCK(iterator);
16192
		snprintf(host, sizeof(host), "%s:%d", iterator->hostname, iterator->portno ? iterator->portno : STANDARD_SIP_PORT);
16190
		snprintf(host, sizeof(host), "%s:%d", iterator->hostname, iterator->portno ? iterator->portno : STANDARD_SIP_PORT);
16193
		ast_cli(a->fd, FORMAT, host, iterator->username, iterator->mailbox, iterator->subscribed ? "Yes" : "No");
16191
		ast_cli(a->fd, FORMAT, host, iterator->username, iterator->mailbox, AST_CLI_YESNO(iterator->subscribed));
16194
		ASTOBJ_UNLOCK(iterator);
16192
		ASTOBJ_UNLOCK(iterator);
16195
	} while(0));
16193
	} while(0));
16196

    
   
16194

   
16197
	return CLI_SUCCESS;
16195
	return CLI_SUCCESS;
16198
#undef FORMAT
16196
#undef FORMAT
[+20] [20] 53 lines
[+20] [+] static int show_channels_cb(void *__cur, void *__arg, int flags)
16252
		
16250
		
16253
		ast_cli(arg->fd, FORMAT, ast_inet_ntoa(dst->sin_addr),
16251
		ast_cli(arg->fd, FORMAT, ast_inet_ntoa(dst->sin_addr),
16254
				S_OR(cur->username, S_OR(cur->cid_num, "(None)")),
16252
				S_OR(cur->username, S_OR(cur->cid_num, "(None)")),
16255
				cur->callid,
16253
				cur->callid,
16256
				ast_getformatname_multiple(formatbuf, sizeof(formatbuf), cur->owner ? cur->owner->nativeformats : 0),
16254
				ast_getformatname_multiple(formatbuf, sizeof(formatbuf), cur->owner ? cur->owner->nativeformats : 0),
16257
				cli_yesno(ast_test_flag(&cur->flags[1], SIP_PAGE2_CALL_ONHOLD)),
16255
				AST_CLI_YESNO(ast_test_flag(&cur->flags[1], SIP_PAGE2_CALL_ONHOLD)),
16258
				cur->needdestroy ? "(d)" : "",
16256
				cur->needdestroy ? "(d)" : "",
16259
				cur->lastmsg ,
16257
				cur->lastmsg ,
16260
				referstatus
16258
				referstatus
16261
			);
16259
			);
16262
		arg->numchans++;
16260
		arg->numchans++;
[+20] [20] 240 lines
[+20] [+] static char *sip_show_channel(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
16503
			ast_cli(a->fd, "  Our Codec Capability:   %s\n", ast_getformatname_multiple(formatbuf, sizeof(formatbuf), cur->capability));
16501
			ast_cli(a->fd, "  Our Codec Capability:   %s\n", ast_getformatname_multiple(formatbuf, sizeof(formatbuf), cur->capability));
16504
			ast_cli(a->fd, "  Non-Codec Capability (DTMF):   %d\n", cur->noncodeccapability);
16502
			ast_cli(a->fd, "  Non-Codec Capability (DTMF):   %d\n", cur->noncodeccapability);
16505
			ast_cli(a->fd, "  Their Codec Capability:   %s\n", ast_getformatname_multiple(formatbuf, sizeof(formatbuf), cur->peercapability));
16503
			ast_cli(a->fd, "  Their Codec Capability:   %s\n", ast_getformatname_multiple(formatbuf, sizeof(formatbuf), cur->peercapability));
16506
			ast_cli(a->fd, "  Joint Codec Capability:   %s\n", ast_getformatname_multiple(formatbuf, sizeof(formatbuf), cur->jointcapability));
16504
			ast_cli(a->fd, "  Joint Codec Capability:   %s\n", ast_getformatname_multiple(formatbuf, sizeof(formatbuf), cur->jointcapability));
16507
			ast_cli(a->fd, "  Format:                 %s\n", ast_getformatname_multiple(formatbuf, sizeof(formatbuf), cur->owner ? cur->owner->nativeformats : 0) );
16505
			ast_cli(a->fd, "  Format:                 %s\n", ast_getformatname_multiple(formatbuf, sizeof(formatbuf), cur->owner ? cur->owner->nativeformats : 0) );
16508
			ast_cli(a->fd, "  T.38 support            %s\n", cli_yesno(cur->udptl != NULL));
16506
			ast_cli(a->fd, "  T.38 support            %s\n", AST_CLI_YESNO(cur->udptl != NULL));
16509
			ast_cli(a->fd, "  Video support           %s\n", cli_yesno(cur->vrtp != NULL));
16507
			ast_cli(a->fd, "  Video support           %s\n", AST_CLI_YESNO(cur->vrtp != NULL));
16510
			ast_cli(a->fd, "  MaxCallBR:              %d kbps\n", cur->maxcallbitrate);
16508
			ast_cli(a->fd, "  MaxCallBR:              %d kbps\n", cur->maxcallbitrate);
16511
			ast_cli(a->fd, "  Theoretical Address:    %s:%d\n", ast_inet_ntoa(cur->sa.sin_addr), ntohs(cur->sa.sin_port));
16509
			ast_cli(a->fd, "  Theoretical Address:    %s:%d\n", ast_inet_ntoa(cur->sa.sin_addr), ntohs(cur->sa.sin_port));
16512
			ast_cli(a->fd, "  Received Address:       %s:%d\n", ast_inet_ntoa(cur->recv.sin_addr), ntohs(cur->recv.sin_port));
16510
			ast_cli(a->fd, "  Received Address:       %s:%d\n", ast_inet_ntoa(cur->recv.sin_addr), ntohs(cur->recv.sin_port));
16513
			ast_cli(a->fd, "  SIP Transfer mode:      %s\n", transfermode2str(cur->allowtransfer));
16511
			ast_cli(a->fd, "  SIP Transfer mode:      %s\n", transfermode2str(cur->allowtransfer));
16514
			ast_cli(a->fd, "  Force rport:            %s\n", cli_yesno(ast_test_flag(&cur->flags[0], SIP_NAT_FORCE_RPORT)));
16512
			ast_cli(a->fd, "  Force rport:            %s\n", AST_CLI_YESNO(ast_test_flag(&cur->flags[0], SIP_NAT_FORCE_RPORT)));
16515
			ast_cli(a->fd, "  Audio IP:               %s %s\n", ast_inet_ntoa(cur->redirip.sin_addr.s_addr ? cur->redirip.sin_addr : cur->ourip.sin_addr), cur->redirip.sin_addr.s_addr ? "(Outside bridge)" : "(local)" );
16513
			ast_cli(a->fd, "  Audio IP:               %s %s\n", ast_inet_ntoa(cur->redirip.sin_addr.s_addr ? cur->redirip.sin_addr : cur->ourip.sin_addr), cur->redirip.sin_addr.s_addr ? "(Outside bridge)" : "(local)" );
16516
			ast_cli(a->fd, "  Our Tag:                %s\n", cur->tag);
16514
			ast_cli(a->fd, "  Our Tag:                %s\n", cur->tag);
16517
			ast_cli(a->fd, "  Their Tag:              %s\n", cur->theirtag);
16515
			ast_cli(a->fd, "  Their Tag:              %s\n", cur->theirtag);
16518
			ast_cli(a->fd, "  SIP User agent:         %s\n", cur->useragent);
16516
			ast_cli(a->fd, "  SIP User agent:         %s\n", cur->useragent);
16519
			if (!ast_strlen_zero(cur->username))
16517
			if (!ast_strlen_zero(cur->username))
16520
				ast_cli(a->fd, "  Username:               %s\n", cur->username);
16518
				ast_cli(a->fd, "  Username:               %s\n", cur->username);
16521
			if (!ast_strlen_zero(cur->peername))
16519
			if (!ast_strlen_zero(cur->peername))
16522
				ast_cli(a->fd, "  Peername:               %s\n", cur->peername);
16520
				ast_cli(a->fd, "  Peername:               %s\n", cur->peername);
16523
			if (!ast_strlen_zero(cur->uri))
16521
			if (!ast_strlen_zero(cur->uri))
16524
				ast_cli(a->fd, "  Original uri:           %s\n", cur->uri);
16522
				ast_cli(a->fd, "  Original uri:           %s\n", cur->uri);
16525
			if (!ast_strlen_zero(cur->cid_num))
16523
			if (!ast_strlen_zero(cur->cid_num))
16526
				ast_cli(a->fd, "  Caller-ID:              %s\n", cur->cid_num);
16524
				ast_cli(a->fd, "  Caller-ID:              %s\n", cur->cid_num);
16527
			ast_cli(a->fd, "  Need Destroy:           %s\n", cli_yesno(cur->needdestroy));
16525
			ast_cli(a->fd, "  Need Destroy:           %s\n", AST_CLI_YESNO(cur->needdestroy));
16528
			ast_cli(a->fd, "  Last Message:           %s\n", cur->lastmsg);
16526
			ast_cli(a->fd, "  Last Message:           %s\n", cur->lastmsg);
16529
			ast_cli(a->fd, "  Promiscuous Redir:      %s\n", cli_yesno(ast_test_flag(&cur->flags[0], SIP_PROMISCREDIR)));
16527
			ast_cli(a->fd, "  Promiscuous Redir:      %s\n", AST_CLI_YESNO(ast_test_flag(&cur->flags[0], SIP_PROMISCREDIR)));
16530
			ast_cli(a->fd, "  Route:                  %s\n", cur->route ? cur->route->hop : "N/A");
16528
			ast_cli(a->fd, "  Route:                  %s\n", cur->route ? cur->route->hop : "N/A");
16531
			ast_cli(a->fd, "  DTMF Mode:              %s\n", dtmfmode2str(ast_test_flag(&cur->flags[0], SIP_DTMF)));
16529
			ast_cli(a->fd, "  DTMF Mode:              %s\n", dtmfmode2str(ast_test_flag(&cur->flags[0], SIP_DTMF)));
16532
			ast_cli(a->fd, "  SIP Options:            ");
16530
			ast_cli(a->fd, "  SIP Options:            ");
16533
			if (cur->sipoptions) {
16531
			if (cur->sipoptions) {
16534
				int x;
16532
				int x;
[+20] [20] 1000 lines
[+20] [+] static void change_redirecting_information(struct sip_pvt *p, struct sip_request *req, struct ast_party_redirecting *redirecting, int set_call_forward)
17535
			ast_free(redirecting->from.name);
17533
			ast_free(redirecting->from.name);
17536
		}
17534
		}
17537
		ast_debug(3, "Got redirecting from name %s\n", redirecting_from_name);
17535
		ast_debug(3, "Got redirecting from name %s\n", redirecting_from_name);
17538
		redirecting->from.name = redirecting_from_name;
17536
		redirecting->from.name = redirecting_from_name;
17539
	}
17537
	}

    
   
17538
	if (!ast_strlen_zero(p->cid_tag)) {

    
   
17539
		if (redirecting->from.tag) {

    
   
17540
			ast_free(redirecting->from.tag);

    
   
17541
		}

    
   
17542
		redirecting->from.tag = ast_strdup(p->cid_tag);

    
   
17543
		if (redirecting->to.tag) {

    
   
17544
			ast_free(redirecting->to.tag);

    
   
17545
		}

    
   
17546
		redirecting->to.tag = ast_strdup(p->cid_tag);

    
   
17547
	}
17540
	if (!ast_strlen_zero(redirecting_to_number)) {
17548
	if (!ast_strlen_zero(redirecting_to_number)) {
17541
		if (redirecting->to.number) {
17549
		if (redirecting->to.number) {
17542
			ast_free(redirecting->to.number);
17550
			ast_free(redirecting->to.number);
17543
		}
17551
		}
17544
		ast_debug(3, "Got redirecting to number %s\n", redirecting_to_number);
17552
		ast_debug(3, "Got redirecting to number %s\n", redirecting_to_number);
[+20] [20] 351 lines
[+20] [+] static void handle_response_invite(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno)
17896
		if (!req->ignore && p->owner) {
17904
		if (!req->ignore && p->owner) {
17897
			if (get_rpid(p, req)) {
17905
			if (get_rpid(p, req)) {
17898
				ast_party_connected_line_init(&connected);
17906
				ast_party_connected_line_init(&connected);
17899
				connected.id.number = (char *) p->cid_num;
17907
				connected.id.number = (char *) p->cid_num;
17900
				connected.id.name = (char *) p->cid_name;
17908
				connected.id.name = (char *) p->cid_name;

    
   
17909
				connected.id.tag = (char *) p->cid_tag;
17901
				connected.id.number_presentation = p->callingpres;
17910
				connected.id.number_presentation = p->callingpres;
17902
				connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
17911
				connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
17903
				ast_channel_queue_connected_line_update(p->owner, &connected);
17912
				ast_channel_queue_connected_line_update(p->owner, &connected);
17904
			}
17913
			}
17905
			sip_handle_cc(p, req, AST_CC_CCNR);
17914
			sip_handle_cc(p, req, AST_CC_CCNR);
[+20] [20] 20 lines
[+20] static void handle_response_invite(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno)
17926
			ast_log(LOG_WARNING, "Unable to cancel SIP destruction.  Expect bad things.\n");
17935
			ast_log(LOG_WARNING, "Unable to cancel SIP destruction.  Expect bad things.\n");
17927
		if (!req->ignore && p->owner) {
17936
		if (!req->ignore && p->owner) {
17928
			struct ast_party_redirecting redirecting = {{0,},};
17937
			struct ast_party_redirecting redirecting = {{0,},};
17929
			change_redirecting_information(p, req, &redirecting, FALSE);
17938
			change_redirecting_information(p, req, &redirecting, FALSE);
17930
			ast_channel_queue_redirecting_update(p->owner, &redirecting);
17939
			ast_channel_queue_redirecting_update(p->owner, &redirecting);

    
   
17940
			ast_party_redirecting_free(&redirecting);
17931
			sip_handle_cc(p, req, AST_CC_CCNR);
17941
			sip_handle_cc(p, req, AST_CC_CCNR);
17932
		}
17942
		}
17933
		check_pendings(p);
17943
		check_pendings(p);
17934
		break;
17944
		break;
17935

    
   
17945

   
[+20] [20] 4 lines
[+20] static void handle_response_invite(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno)
17940
			if (get_rpid(p, req)) {
17950
			if (get_rpid(p, req)) {
17941
				/* Queue a connected line update */
17951
				/* Queue a connected line update */
17942
				ast_party_connected_line_init(&connected);
17952
				ast_party_connected_line_init(&connected);
17943
				connected.id.number = (char *) p->cid_num;
17953
				connected.id.number = (char *) p->cid_num;
17944
				connected.id.name = (char *) p->cid_name;
17954
				connected.id.name = (char *) p->cid_name;

    
   
17955
				connected.id.tag = (char *) p->cid_tag;
17945
				connected.id.number_presentation = p->callingpres;
17956
				connected.id.number_presentation = p->callingpres;
17946
				connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
17957
				connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
17947
				ast_channel_queue_connected_line_update(p->owner, &connected);
17958
				ast_channel_queue_connected_line_update(p->owner, &connected);
17948
			}
17959
			}
17949
			sip_handle_cc(p, req, AST_CC_CCNR);
17960
			sip_handle_cc(p, req, AST_CC_CCNR);
[+20] [20] 35 lines
[+20] static void handle_response_invite(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno)
17985
		if (!req->ignore && p->owner && (get_rpid(p, req) || !reinvite)) {
17996
		if (!req->ignore && p->owner && (get_rpid(p, req) || !reinvite)) {
17986
			/* Queue a connected line update */
17997
			/* Queue a connected line update */
17987
			ast_party_connected_line_init(&connected);
17998
			ast_party_connected_line_init(&connected);
17988
			connected.id.number = (char *) p->cid_num;
17999
			connected.id.number = (char *) p->cid_num;
17989
			connected.id.name = (char *) p->cid_name;
18000
			connected.id.name = (char *) p->cid_name;

    
   
18001
			connected.id.tag = (char *) p->cid_tag;
17990
			connected.id.number_presentation = p->callingpres;
18002
			connected.id.number_presentation = p->callingpres;
17991
			connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
18003
			connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
17992
			ast_channel_queue_connected_line_update(p->owner, &connected);
18004
			ast_channel_queue_connected_line_update(p->owner, &connected);
17993
		}
18005
		}
17994

    
   
18006

   
[+20] [20] 902 lines
[+20] [+] static void handle_response(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno)
18897
				case 305: /* Use Proxy */
18909
				case 305: /* Use Proxy */
18898
				if (p->owner) {
18910
				if (p->owner) {
18899
					struct ast_party_redirecting redirecting = {{0,},};
18911
					struct ast_party_redirecting redirecting = {{0,},};
18900
					change_redirecting_information(p, req, &redirecting, TRUE);
18912
					change_redirecting_information(p, req, &redirecting, TRUE);
18901
					ast_channel_set_redirecting(p->owner, &redirecting);
18913
					ast_channel_set_redirecting(p->owner, &redirecting);

    
   
18914
					ast_party_redirecting_free(&redirecting);
18902
				}
18915
				}
18903
					/* Fall through */
18916
					/* Fall through */
18904
				case 486: /* Busy here */
18917
				case 486: /* Busy here */
18905
				case 600: /* Busy everywhere */
18918
				case 600: /* Busy everywhere */
18906
				case 603: /* Decline */
18919
				case 603: /* Decline */
[+20] [20] 1222 lines
[+20] [+] static int handle_request_update(struct sip_pvt *p, struct sip_request *req)
20129
	if (get_rpid(p, req)) {
20142
	if (get_rpid(p, req)) {
20130
		struct ast_party_connected_line connected;
20143
		struct ast_party_connected_line connected;
20131
		ast_party_connected_line_init(&connected);
20144
		ast_party_connected_line_init(&connected);
20132
		connected.id.number = (char *) p->cid_num;
20145
		connected.id.number = (char *) p->cid_num;
20133
		connected.id.name = (char *) p->cid_name;
20146
		connected.id.name = (char *) p->cid_name;

    
   
20147
		connected.id.tag = (char *) p->cid_tag;
20134
		connected.id.number_presentation = p->callingpres;
20148
		connected.id.number_presentation = p->callingpres;
20135
		connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER;
20149
		connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER;
20136
		ast_channel_queue_connected_line_update(p->owner, &connected);
20150
		ast_channel_queue_connected_line_update(p->owner, &connected);
20137
	}
20151
	}
20138
	transmit_response(p, "200 OK", req);
20152
	transmit_response(p, "200 OK", req);
[+20] [20] 317 lines
[+20] [+] static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int debug, int seqno, struct sockaddr_in *sin, int *recount, const char *e, int *nounlock)
20456
				struct ast_party_connected_line connected;
20470
				struct ast_party_connected_line connected;
20457

    
   
20471

   
20458
				ast_party_connected_line_init(&connected);
20472
				ast_party_connected_line_init(&connected);
20459
				connected.id.number = (char *) p->cid_num;
20473
				connected.id.number = (char *) p->cid_num;
20460
				connected.id.name = (char *) p->cid_name;
20474
				connected.id.name = (char *) p->cid_name;

    
   
20475
				connected.id.tag = (char *) p->cid_tag;
20461
				connected.id.number_presentation = p->callingpres;
20476
				connected.id.number_presentation = p->callingpres;
20462
				connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER;
20477
				connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER;
20463
				ast_channel_queue_connected_line_update(p->owner, &connected);
20478
				ast_channel_queue_connected_line_update(p->owner, &connected);
20464
			}
20479
			}
20465
			/* Handle SDP here if we already have an owner */
20480
			/* Handle SDP here if we already have an owner */
[+20] [20] 17 lines
[+20] static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int debug, int seqno, struct sockaddr_in *sin, int *recount, const char *e, int *nounlock)
20483
		ast_verbose("Ignoring this INVITE request\n");
20498
		ast_verbose("Ignoring this INVITE request\n");
20484

    
   
20499

   
20485
	if (!p->lastinvite && !req->ignore && !p->owner) {
20500
	if (!p->lastinvite && !req->ignore && !p->owner) {
20486
		/* This is a new invite */
20501
		/* This is a new invite */
20487
		/* Handle authentication if this is our first invite */
20502
		/* Handle authentication if this is our first invite */
20488
		struct ast_party_redirecting redirecting = {{0,},};

   
20489
		int cc_recall_core_id = -1;
20503
		int cc_recall_core_id = -1;
20490
		set_pvt_allowed_methods(p, req);
20504
		set_pvt_allowed_methods(p, req);
20491
		res = check_user(p, req, SIP_INVITE, e, XMIT_RELIABLE, sin);
20505
		res = check_user(p, req, SIP_INVITE, e, XMIT_RELIABLE, sin);
20492
		if (res == AUTH_CHALLENGE_SENT) {
20506
		if (res == AUTH_CHALLENGE_SENT) {
20493
			p->invitestate = INV_COMPLETED;		/* Needs to restart in another INVITE transaction */
20507
			p->invitestate = INV_COMPLETED;		/* Needs to restart in another INVITE transaction */
[+20] [20] 59 lines
[+20] static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int debug, int seqno, struct sockaddr_in *sin, int *recount, const char *e, int *nounlock)
20553
			}
20567
			}
20554
			res = 0;
20568
			res = 0;
20555
			goto request_invite_cleanup;
20569
			goto request_invite_cleanup;
20556
		}
20570
		}
20557
		gotdest = get_destination(p, NULL, &cc_recall_core_id);	/* Get destination right away */
20571
		gotdest = get_destination(p, NULL, &cc_recall_core_id);	/* Get destination right away */
20558
		change_redirecting_information(p, req, &redirecting, FALSE); /*Will return immediately if no Diversion header is present */

   
20559
		extract_uri(p, req);			/* Get the Contact URI */
20572
		extract_uri(p, req);			/* Get the Contact URI */
20560
		build_contact(p);			/* Build our contact header */
20573
		build_contact(p);			/* Build our contact header */
20561

    
   
20574

   
20562
		if (p->rtp) {
20575
		if (p->rtp) {
20563
			ast_rtp_instance_set_prop(p->rtp, AST_RTP_PROPERTY_DTMF, ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_RFC2833);
20576
			ast_rtp_instance_set_prop(p->rtp, AST_RTP_PROPERTY_DTMF, ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_RFC2833);
[+20] [20] 7 lines
[+20] static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int debug, int seqno, struct sockaddr_in *sin, int *recount, const char *e, int *nounlock)
20571
				char *decoded_exten = ast_strdupa(p->exten);
20584
				char *decoded_exten = ast_strdupa(p->exten);
20572

    
   
20585

   
20573
				transmit_response_reliable(p, "404 Not Found", req);
20586
				transmit_response_reliable(p, "404 Not Found", req);
20574
				ast_uri_decode(decoded_exten);
20587
				ast_uri_decode(decoded_exten);
20575
				ast_log(LOG_NOTICE, "Call from '%s' to extension"
20588
				ast_log(LOG_NOTICE, "Call from '%s' to extension"
20576
					" '%s' rejected because extension not found.\n",
20589
					" '%s' rejected because extension not found in context '%s'.\n",
20577
					S_OR(p->username, p->peername), decoded_exten);
20590
					S_OR(p->username, p->peername), decoded_exten, p->context);
20578
			}
20591
			}
20579
			p->invitestate = INV_COMPLETED;
20592
			p->invitestate = INV_COMPLETED;
20580
			update_call_counter(p, DEC_CALL_LIMIT);
20593
			update_call_counter(p, DEC_CALL_LIMIT);
20581
			sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
20594
			sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
20582
			res = 0;
20595
			res = 0;
[+20] [20] 17 lines
[+20] static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int debug, int seqno, struct sockaddr_in *sin, int *recount, const char *e, int *nounlock)
20600

    
   
20613

   
20601
			/* Save Record-Route for any later requests we make on this dialogue */
20614
			/* Save Record-Route for any later requests we make on this dialogue */
20602
			build_route(p, req, 0);
20615
			build_route(p, req, 0);
20603

    
   
20616

   
20604
			if (c) {
20617
			if (c) {

    
   
20618
				struct ast_party_redirecting redirecting = { { 0, }, };
20605
				/* Pre-lock the call */
20619
				/* Pre-lock the call */
20606
				ast_channel_lock(c);
20620
				ast_channel_lock(c);

    
   
20621
				change_redirecting_information(p, req, &redirecting, FALSE); /*Will return immediately if no Diversion header is present */
20607
				ast_channel_set_redirecting(c, &redirecting);
20622
				ast_channel_set_redirecting(c, &redirecting);

    
   
20623
				ast_party_redirecting_free(&redirecting);
20608
			}
20624
			}
20609
		}
20625
		}
20610
	} else {
20626
	} else {
20611
		struct ast_party_redirecting redirecting = {{0,},};
20627
		struct ast_party_redirecting redirecting = {{0,},};
20612
		if (sipdebug) {
20628
		if (sipdebug) {
[+20] [20] 7 lines
[+20] static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int debug, int seqno, struct sockaddr_in *sin, int *recount, const char *e, int *nounlock)
20620
		c = p->owner;
20636
		c = p->owner;
20621
		change_redirecting_information(p, req, &redirecting, FALSE); /*Will return immediately if no Diversion header is present */
20637
		change_redirecting_information(p, req, &redirecting, FALSE); /*Will return immediately if no Diversion header is present */
20622
		if (c) {
20638
		if (c) {
20623
			ast_channel_set_redirecting(c, &redirecting);
20639
			ast_channel_set_redirecting(c, &redirecting);
20624
		}
20640
		}

    
   
20641
		ast_party_redirecting_free(&redirecting);
20625
	}
20642
	}
20626

    
   
20643

   
20627
	/* Session-Timers */
20644
	/* Session-Timers */
20628
	if (p->sipoptions & SIP_OPT_TIMER) {
20645
	if (p->sipoptions & SIP_OPT_TIMER) {
20629
		/* The UAC has requested session-timers for this session. Negotiate
20646
		/* The UAC has requested session-timers for this session. Negotiate
[+20] [20] 451 lines
[+20] [+] static int local_attended_transfer(struct sip_pvt *transferer, struct sip_dual *current, struct sip_request *req, int seqno, int *nounlock)
21081
		if (target.chan2) {
21098
		if (target.chan2) {
21082
			ast_channel_queue_connected_line_update(target.chan1, &connected_to_transferee);
21099
			ast_channel_queue_connected_line_update(target.chan1, &connected_to_transferee);
21083
			ast_channel_queue_connected_line_update(target.chan2, &connected_to_target);
21100
			ast_channel_queue_connected_line_update(target.chan2, &connected_to_target);
21084
		} else {
21101
		} else {
21085
			/* Since target.chan1 isn't actually connected to another channel, there is no way for us
21102
			/* Since target.chan1 isn't actually connected to another channel, there is no way for us
21086
			 * to queue a frame so that its connected line status will be updated. Instead, we have to
21103
			 * to queue a frame so that its connected line status will be updated.
21087
			 * change it directly. Since we are not the channel thread, we cannot run a connected line
21104
			 *
21088
			 * interception macro on target.chan1
21105
			 * Instead, we use the somewhat hackish approach of using a special control frame type that

    
   
21106
			 * instructs ast_read to perform a specific action. In this case, the frame we queue tells

    
   
21107
			 * ast_read to call the connected line interception macro configured for target.chan1.

    
   
21108
			 */

    
   
21109
			struct ast_control_read_action_payload *frame_payload;

    
   
21110
			int payload_size;

    
   
21111
			int frame_size;

    
   
21112
			unsigned char connected_line_data[1024];

    
   
21113
			payload_size = ast_connected_line_build_data(connected_line_data, sizeof(connected_line_data), &connected_to_target);

    
   
21114
			frame_size = payload_size + sizeof(*frame_payload);

    
   
21115
			if (payload_size != -1 && (frame_payload = alloca(frame_size))) {

    
   
21116
				frame_payload->payload_size = payload_size;

    
   
21117
				memcpy(frame_payload->payload, connected_line_data, payload_size);

    
   
21118
				frame_payload->action = AST_FRAME_READ_ACTION_CONNECTED_LINE_MACRO;

    
   
21119
				ast_queue_control_data(target.chan1, AST_CONTROL_READ_ACTION, frame_payload, frame_size);

    
   
21120
			}

    
   
21121
			/* In addition to queueing the read action frame so that target.chan1's connected line info

    
   
21122
			 * will be updated, we also are going to queue a plain old connected line update on target.chan1. This

    
   
21123
			 * way, either Dial or Queue can apply this connected line update to the outgoing ringing channel.
21089
			 */
21124
			 */
21090
			ast_channel_update_connected_line(target.chan1, &connected_to_target);
21125
			ast_channel_queue_connected_line_update(target.chan1, &connected_to_transferee);

    
   
21126

   
21091
		}
21127
		}
21092
		ast_channel_unref(current->chan1);
21128
		ast_channel_unref(current->chan1);
21093
	}
21129
	}
21094

    
   
21130

   
21095
	/* at this point if the transfer is successful only the transferer pvt should be locked. */
21131
	/* at this point if the transfer is successful only the transferer pvt should be locked. */
[+20] [20] 3630 lines
[+20] [+] static void set_peer_defaults(struct sip_peer *peer)
24726
	ast_string_field_set(peer, secret, "");
24762
	ast_string_field_set(peer, secret, "");
24727
	ast_string_field_set(peer, remotesecret, "");
24763
	ast_string_field_set(peer, remotesecret, "");
24728
	ast_string_field_set(peer, md5secret, "");
24764
	ast_string_field_set(peer, md5secret, "");
24729
	ast_string_field_set(peer, cid_num, "");
24765
	ast_string_field_set(peer, cid_num, "");
24730
	ast_string_field_set(peer, cid_name, "");
24766
	ast_string_field_set(peer, cid_name, "");

    
   
24767
	ast_string_field_set(peer, cid_tag, "");
24731
	ast_string_field_set(peer, fromdomain, "");
24768
	ast_string_field_set(peer, fromdomain, "");
24732
	ast_string_field_set(peer, fromuser, "");
24769
	ast_string_field_set(peer, fromuser, "");
24733
	ast_string_field_set(peer, regexten, "");
24770
	ast_string_field_set(peer, regexten, "");
24734
	peer->callgroup = 0;
24771
	peer->callgroup = 0;
24735
	peer->pickupgroup = 0;
24772
	peer->pickupgroup = 0;
[+20] [20] 205 lines
[+20] [+] static struct sip_peer *build_peer(const char *name, struct ast_variable *v, struct ast_variable *alt, int realtime, int devstate_only)
24941
			} else if (!strcasecmp(v->name, "trunkname")) {
24978
			} else if (!strcasecmp(v->name, "trunkname")) {
24942
				/* This is actually for a trunk, so we don't want to override callerid */
24979
				/* This is actually for a trunk, so we don't want to override callerid */
24943
				ast_string_field_set(peer, cid_name, "");
24980
				ast_string_field_set(peer, cid_name, "");
24944
			} else if (!strcasecmp(v->name, "cid_number")) {
24981
			} else if (!strcasecmp(v->name, "cid_number")) {
24945
				ast_string_field_set(peer, cid_num, v->value);
24982
				ast_string_field_set(peer, cid_num, v->value);

    
   
24983
			} else if (!strcasecmp(v->name, "cid_tag")) {

    
   
24984
				ast_string_field_set(peer, cid_tag, v->value);
24946
			} else if (!strcasecmp(v->name, "context")) {
24985
			} else if (!strcasecmp(v->name, "context")) {
24947
				ast_string_field_set(peer, context, v->value);
24986
				ast_string_field_set(peer, context, v->value);
24948
				ast_set_flag(&peer->flags[1], SIP_PAGE2_HAVEPEERCONTEXT);
24987
				ast_set_flag(&peer->flags[1], SIP_PAGE2_HAVEPEERCONTEXT);
24949
			} else if (!strcasecmp(v->name, "subscribecontext")) {
24988
			} else if (!strcasecmp(v->name, "subscribecontext")) {
24950
				ast_string_field_set(peer, subscribecontext, v->value);
24989
				ast_string_field_set(peer, subscribecontext, v->value);
[+20] [20] 2356 lines
/trunk/include/asterisk/_private.h
Diff Revision 3 Diff Revision 5
 
/trunk/include/asterisk/options.h
Diff Revision 3 Diff Revision 5
 
/trunk/main/asterisk.c
Diff Revision 3 Diff Revision 5
 
/trunk/main/channel.c
Diff Revision 3 Diff Revision 5
 
/trunk/main/loader.c
Diff Revision 3 Diff Revision 5
 
  1. /trunk/channels/chan_sip.c: Loading...
  2. /trunk/include/asterisk/_private.h: Loading...
  3. /trunk/include/asterisk/options.h: Loading...
  4. /trunk/main/asterisk.c: Loading...
  5. /trunk/main/channel.c: Loading...
  6. /trunk/main/loader.c: Loading...

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.