SIP response 410 GONE

How to send SIP response 410 GONE from asterisk dialplan

Hangup(22) will do this I believe.

Dear John,

I already tested the same.After this SIP BYE response is changed but ISUP REL packet did not change.

I dont think it is posible to send a specific SIP response through the Asterisk dialplan,

A SIP response is a message generated by a user agent server (UAS) or SIP server to reply a request generated by a client. It could be a formal acknowledgement to prevent retransmission of requests by a UAC.

Dear Ambiorixg,

Any other possible way, in case of asterisk…

22 should work, as long as you use it before ANSWER. You cannot generate SIP response codes after answer. If you are sending BYE, you have already answered so you cannot return a SIP response code.

	switch (cause) {
		case AST_CAUSE_UNALLOCATED:		/* 1 */
		case AST_CAUSE_NO_ROUTE_DESTINATION:	/* 3 IAX2: Can't find extension in context */
			return "404 Not Found";
		case AST_CAUSE_CONGESTION:		/* 34 */
			return "503 Service Unavailable";
			return "408 Request Timeout";
		case AST_CAUSE_NO_ANSWER:		/* 19 */
		case AST_CAUSE_UNREGISTERED:        /* 20 */
			return "480 Temporarily unavailable";
		case AST_CAUSE_CALL_REJECTED:		/* 21 */
			return "403 Forbidden";
		case AST_CAUSE_NUMBER_CHANGED:		/* 22 */
			return "410 Gone";
			return "480 Temporarily unavailable";
			return "484 Address incomplete";
			return "486 Busy here";
			return "500 Server internal failure";
			return "501 Not Implemented";
			return "503 Service Unavailable";
		/* Used in chan_iax2 */
			return "502 Bad Gateway";
		case AST_CAUSE_BEARERCAPABILITY_NOTAVAIL:	/* Can't find codec to connect to host */
			return "488 Not Acceptable Here";
		case AST_CAUSE_INTERWORKING:	/* Unspecified Interworking issues */
			return "500 Network error";
1 Like

Dear David,

I have sent Hangup(22) but still SS7 trace showing 16 response code.

Please provide the sip set debug output and core set verbose 5 output (although I suspect they will show that you answered the call).

<— SIP read from UDP: —>
ACK sip:900@ SIP/2.0
Via: SIP/2.0/UDP;branch=z9hG4bK004ea5ee6958e6118a7aa1fdcfd12756;rport
From: “PhonerLite” sip:9888445756@;tag=2907100300
To: sip:900@;tag=as51f94290
Call-ID: 004EA5EE-6958-E611-8A77-A1FDCFD12756@
CSeq: 19 ACK
Contact: sip:9888445756@
Authorization: Digest username=“9888445756”, realm=“telunet”, nonce=“2a5d07b4”, uri="sip:900@", response=“5c933ed981a4f85ee35e2a4504c6d994”, algorithm=MD5
Max-Forwards: 70
Content-Length: 0

— (10 headers 0 lines) —
> 0xb73142e8 – Probation passed - setting RTP source address to
– <SIP/9888445756-00000001> Playing ‘/usr/src/prompts/Sub.gsm’ (language ‘En’)
– Executing [900@CONFERENCE:3] Hangup(“SIP/9888445756-00000001”, “22”) in new stack
== Spawn extension (CONFERENCE, 900, 3) exited non-zero on 'SIP/9888445756-00000001’
Scheduling destruction of SIP dialog ‘004EA5EE-6958-E611-8A77-A1FDCFD12756@’ in 32000 ms (Method: ACK)
set_destination: Parsing sip:9888445756@ for address/port to send to
set_destination: set destination to
Reliably Transmitting (no NAT) to
BYE sip:9888445756@ SIP/2.0
Via: SIP/2.0/UDP;branch=z9hG4bK23bdb3d7;rport
Max-Forwards: 70
From: sip:900@;tag=as51f94290
To: “PhonerLite” sip:9888445756@;tag=2907100300
Call-ID: 004EA5EE-6958-E611-8A77-A1FDCFD12756@
CSeq: 102 BYE
User-Agent: LITE PBX
Proxy-Authorization: Digest username=“9888445756”, realm=“telunet”, algorithm=MD5, uri=“sip:”, nonce=“2a5d07b4”, response="87d94feb59853c0b7e2b2322a6232609"
X-Asterisk-HangupCause: Number changed
X-Asterisk-HangupCauseCode: 22
Content-Length: 0

Your trace is incomplete. You have answered the call,so SIP can no longer send 410.

At a minimum, you need to specify the no answer parameter on Playback. I think you may also need to call Progress explicitly. However, without the full trace or dialplan, I can’t see if you have done anything else to answer the call.

NB it is very unlikely that any PSTN operator will accept early media and you may find general support of early media in circuit switched network gateways to be limited.

Thanks david,Now It is working.

One more Query,

how to send contact detail with sip response 410 in asterisk dialplan

If you are responding 410 it is a prerequisite that you do know the contact details!

21.4.10 410 Gone

The requested resource is no longer available at the server and no
forwarding address is known. This condition is expected to be
considered permanent. If the server does not know, or has no
facility to determine, whether or not the condition is permanent, the
status code 404 (Not Found) SHOULD be used instead.

We want to do POC for a solution where call will be redirected from our machine to MSC. Below are the flow steps:

  1. Customer (A) dials a mobile no (B), MSC route the call to our IVR.
  2. We accept the call (using Asterisk application) without answer call & played a prompt.
  3. In few seconds we want to hangup the call after setting call redirection parameter with contact detail.
    How it is feasible?

POC = proof of concept?
MSC = mobile switching centre???

You need early media permissions for this, which you will generally only get if you are recognized network operator in your country.

In principle you then call Progress, playback the announcement in no-answer mode, and finally use the Transfer application, which will send 302, which does allow a new target to be specified.

However, this is an unusual request, and I’ve never heard of anyone doing early media followed by a 302 redirect. Asterisk has no mechanism to send 301 (not that one would necessarily expect the client to distinguish this from 302).

(If you answer, Asterisk will try to do a blind transfer using REFER.)

1 Like

POC = proof of concept.
MSC = mobile switching center.

we want to submit below mentioned REL packet from asterisk with Dahdi,SS7 and Sangoma card

15:18 50.290 <-- [0x000000f6] IAM in cs_READY, i=1, p:010601000702600109010a020100040683905502770f0a07031389913828560801001d038090a300
15:18 50.306 <== [0x000000f6] MT_OFFERED_IND in cs_OFFERED, size=116
15:18 50.321 ==> [0x000000f6] MT_ACCEPT_REQ in cs_OFFERED, size=16
15:18 50.321 --> [0x000000f6] ACM in cs_ACCEPTED, p:061102101600
15:18 50.353 ==> [0x000000f6] MT_ANSWER_REQ in cs_ACCEPTED, size=6
15:18 50.353 --> [0x000000f6] ANM in cs_CONNECTED, p:0900
15:19 30.760 ==> [0x000000f6] MT_SNDMSG_REQ in cs_CONNECTED, size=41
15:19 30.760 --> [0x000000f6] REL in cs_CONNECTED, p:0c12028097130231310c0a019a552111000000000000
15:19 30.760 ==> [0x000000f6] MT_DROPCALL_REQ in cs_CONNECTED, size=15
15:19 30.760 --> [0x000000f6] REL in cs_DROPPED, p:0c1202809000
15:19 30.838 <-- [0x000000f6] RLC in cs_DROPPED, i=1, p:1000
15:19 30.838 <== [0x000000f6] MT_DROPCALL_CONF in cs_READY, size=14

I don’t understand where the Sangoma card fits into this as we were talking about SIP and sending it to something outside Asterisk.

For support with a Sangoma card you will need to contact Sangoma. However, as far as I know, the DAHDI channel driver doesn’t support the Transfer application.

SIP doesn’t support sending call completion statuses after answer.

Can we pass extra info with 410 response from asterisk?

No. In any case, the only reason that 410 exists is to cover those cases where you don’t have the extra information that would be needed to send 301 0r 302.

How we can send extra info with 301 or 302 from Asterisk Dialplan?

Already answered above. You cannot send these without sending a URI in the Contact header.