[asterisk-bugs] [JIRA] (PRI-168) DISCONNECT with Progress Indicator #8

Armen Karlozian (JIRA) noreply at issues.asterisk.org
Sun May 11 21:42:43 CDT 2014


    [ https://issues.asterisk.org/jira/browse/PRI-168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=218039#comment-218039 ] 

Armen Karlozian edited comment on PRI-168 at 5/11/14 9:42 PM:
--------------------------------------------------------------

Hi Richard and everyone else who may be watching,

SUCCESS!!  I have been able to accomplish the Disconnect with PI #8, however, there is still one more bug which I need help with. I'm not sure if anyone is even reading these posts but hopefully someone will chime in.  This is what I've done so far.

1) As posted in my comment on 7 May, I modified the *Q931_DISCONNECT* function in the "q931.c" file.  This allows the CPE to stay on the channel (ie the PBX won't hangup any longer because it now is waiting for the in-band announcement or tone".  This worked great, however, Asterisk was hangup up the channel anyways... so I had to work backwards and make Asterisk NOT hangup the channel but somehow call the *Q931_DISCONNECT* function.... so.

2) In the same "q931.c" file, I modified the *Q931_CALL_PROCEEDING* function to CALL the *Q931_DISCONNECT* function.  I did this because calling Proceed() in the dialplan is very easy and since it's not being used for anything, it was the best "way in".... so:

I modified as follows:
-----------------------

//#ifdef ALERTING_NO_PROGRESS *COMMENTED OUT THE ENTIRE ifdef nest*

*ADDED THIS INSTEAD:*
static int disconnect_ies2[]={ Q931_CAUSE, Q931_IE_FACILITY, Q931_PROGRESS_INDICATOR, -1 }

---

Next, I added *c->cause = 1;* in the _"if (info)"_ nest... as follows: BTW ignore the double brackets, it's just what I used to display text properly..


int q931_call_proceeding(struct pri *ctrl, q931_call *c, int channel, int info)
{
	if (c->proc) {
		/* We have already sent a PROCEEDING message.  Don't send another one. */
		return 0;
	}
	if (c->ourcallstate == Q931_CALL_STATE_CALL_INDEPENDENT_SERVICE) {
		/* Cannot send this message when in this state */
		return 0;
	}
	if (channel) { 
		c->ds1no = (channel & 0xff00) >> 8;
		c->ds1explicit = (channel & 0x10000) >> 16;
		c->channelno = channel & 0xff;
	}
	c->chanflags &= ~FLAG_PREFERRED;
	c->chanflags |= FLAG_EXCLUSIVE;
	UPDATE_OURCALLSTATE(ctrl, c, Q931_CALL_STATE_INCOMING_CALL_PROCEEDING);
	c->peercallstate = Q931_CALL_STATE_OUTGOING_CALL_PROCEEDING;
	if (info) {{

		*c->cause = 1; This is the important part but need an int variable here I can fill*

		c->progloc = LOC_PRIV_NET_LOCAL_USER;

		c->progcode = CODE_CCITT;

		c->progressmask = PRI_PROG_INBAND_AVAILABLE;

	}} else
		c->progressmask = 0;
	c->proc = 1;
	c->alive = 1;

Then I *COMMENTED OUT* this:
//return send_message(ctrl, c, Q931_CALL_PROCEEDING, call_proceeding_ies);

and replaced it with this:
*return send_message(ctrl, c, Q931_DISCONNECT, disconnect_ies2);*

------

Now I need someone to help me because I need to figure out a way to "feed" the _c->cause_ variable with the Cause Code I want to send.  At this point, I have the number "1" there which is for Unallocated numbers but obviously, I'll need some kind of gloabal int variable I can use here.

I was thinking, is there a way I can use the variable which is set in PRI_CAUSE in the dialplan???  Richard if you can give some pointers that would be great... then all I would need to do is set the PRI_CAUSE variable and then call Proceed() in the dialplan to make all of this work... then finally Hangup().

Cheers,
Armen


was (Author: armeniki):
Hi Richard and everyone else who may be watching,

SUCCESS!!  I have been able to accomplish the Disconnect with PI #8, however, there is still one more bug which I need help with. I'm not sure if anyone is even reading these posts but hopefully someone will chime in.  This is what I've done so far.

1) As posted in my comment on 7 May, I modified the *Q931_DISCONNECT* function in the "q931.c" file.  This allows the CPE to stay on the channel (ie the PBX won't hangup any longer because it now is waiting for the in-band announcement or tone".  This worked great, however, Asterisk was hangup up the channel anyways... so I had to work backwards and make Asterisk NOT hangup the channel but somehow call the *Q931_DISCONNECT* function.... so.

2) In the same "q931.c" file, I modified the *Q931_CALL_PROCEEDING* function to CALL the *Q931_DISCONNECT* function.  I did this because calling Proceed() in the dialplan is very easy and since it's not being used for anything, it was the best "way in".... so:

I modified as follows:
-----------------------

//#ifdef ALERTING_NO_PROGRESS *COMMENTED OUT THE ENTIRE ifdef nest*

*ADDED THIS INSTEAD:*
static int disconnect_ies2[]={ Q931_CAUSE, Q931_IE_FACILITY, Q931_PROGRESS_INDICATOR, -1 }

---

Next, I added *c->cause = 1;* in the _"if (info)"_ nest... as follows: BTW ignore the double brackets, it's just what I used to display text properly..


int q931_call_proceeding(struct pri *ctrl, q931_call *c, int channel, int info)
{
	if (c->proc) {
		/* We have already sent a PROCEEDING message.  Don't send another one. */
		return 0;
	}
	if (c->ourcallstate == Q931_CALL_STATE_CALL_INDEPENDENT_SERVICE) {
		/* Cannot send this message when in this state */
		return 0;
	}
	if (channel) { 
		c->ds1no = (channel & 0xff00) >> 8;
		c->ds1explicit = (channel & 0x10000) >> 16;
		c->channelno = channel & 0xff;
	}
	c->chanflags &= ~FLAG_PREFERRED;
	c->chanflags |= FLAG_EXCLUSIVE;
	UPDATE_OURCALLSTATE(ctrl, c, Q931_CALL_STATE_INCOMING_CALL_PROCEEDING);
	c->peercallstate = Q931_CALL_STATE_OUTGOING_CALL_PROCEEDING;
	if (info) {{

		c->cause = 1;

		c->progloc = LOC_PRIV_NET_LOCAL_USER;

		c->progcode = CODE_CCITT;

		c->progressmask = PRI_PROG_INBAND_AVAILABLE;

	}} else
		c->progressmask = 0;
	c->proc = 1;
	c->alive = 1;

Then I *COMMENTED OUT* this:
//return send_message(ctrl, c, Q931_CALL_PROCEEDING, call_proceeding_ies);

and replaced it with this:
*return send_message(ctrl, c, Q931_DISCONNECT, disconnect_ies2);*

------

Now I need someone to help me because I need to figure out a way to "feed" the _c->cause_ variable with the Cause Code I want to send.  At this point, I have the number "1" there which is for Unallocated numbers but obviously, I'll need some kind of gloabal int variable I can use here.

I was thinking, is there a way I can use the variable which is set in PRI_CAUSE in the dialplan???  Richard if you can give some pointers that would be great... then all I would need to do is set the PRI_CAUSE variable and then call Proceed() in the dialplan to make all of this work... then finally Hangup().

Cheers,
Armen

> DISCONNECT with Progress Indicator #8
> -------------------------------------
>
>                 Key: PRI-168
>                 URL: https://issues.asterisk.org/jira/browse/PRI-168
>             Project: LibPRI
>          Issue Type: New Feature
>      Security Level: None
>    Affects Versions: 1.4.13
>            Reporter: Armen Karlozian
>            Severity: Minor
>
> Hi everyone,
> As you know, currently when the Hangup() command is used in the Asterisk dial plan, it will tear down both the far and and near end of the call and audio amongst other things.  In addition, there is a way of indicating the PRI Cause Code to the user by entering the code within the parenthesis ie: Hangup(1) or Hangup(16), etc.
> Here is the issue:  We have a PBX connected to an E1/PRI from the Telco.  This is a production system and does not use Asterisk.  On this system, whenever someone dials a number which is busy, for example, the phone's display will show the standard PRI message "user busy" and the user will hear an engaged signal (busy signal).  Likewise, if a wrong number is dialled, the display will show "unallocated num" and another tone or message will be heard.... and so on.
> Currently, we're doing tests on the same type of system connected to Asterisk via an E1/PRI and have found that this does not happen.  Basically, if the user dials a busy number, they will hear a busy signal but they won't see the "user busy" message.  Alternatively, if we change the extension script a bit, we can issue a Hangup(17) to make the phone show "user busy" but then there's no way to play the busy signal because the phone/channel hangs up.
> SO....
> Would it be possible to perhaps create a new function called "SendPRICause()" (kind of like the SendText function for SIP phones) so that we can use that instead of Hangup()?
> This way the use can see the message and hear whatever recording needs to be played to them at the same time.
> An example of its usage could be:
> exten => s-DN_CHANGED,1,Progress()
> exten => s-DN_CHANGED,1,SendPRICause(22)
> exten => s-DN_CHANGED,n,Playback(/var/lib/asterisk/sounds/tel/sorry-number-changed,noanswer)
> exten => s-DN_CHANGED,n,Hangup()
> --------------------------
> Cheers,
> Armen



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list