mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 02:37:10 +00:00 
			
		
		
		
	chan_pjsip: Add technology-specific off-nominal hangup cause to events.
Although the ISDN/Q.850/Q.931 hangup cause code is already part of the ARI and AMI hangup and channel destroyed events, it can be helpful to know what the actual channel technology code was if the call was unsuccessful. For PJSIP, it's the SIP response code. * A new "tech_hangupcause" field was added to the ast_channel structure along with ast_channel_tech_hangupcause() and ast_channel_tech_hangupcause_set() functions. It should only be set for off-nominal terminations. * chan_pjsip was modified to set the tech hangup cause in the chan_pjsip_hangup() and chan_pjsip_session_end() functions. This is a bit tricky because these two functions aren't always called in the same order. The channel that hangs up first will get chan_pjsip_session_end() called first which will trigger the core to call chan_pjsip_hangup() on itself, then call chan_pjsip_hangup() on the other channel. The other channel's chan_pjsip_session_end() function will get called last. Unfortunately, the other channel's HangupRequest events are sent before chan_pjsip has had a chance to set the tech hangupcause code so the HangupRequest events for that channel won't have the cause code set. The ChannelDestroyed and Hangup events however will have the code set for both channels. * A new "tech_cause" field was added to the ast_channel_snapshot_hangup structure. This is a public structure so a bit of refactoring was needed to preserve ABI compatibility. * The ARI ChannelHangupRequest and ChannelDestroyed events were modified to include the "tech_cause" parameter in the JSON for off-nominal terminations. The parameter is suppressed for nominal termination. * The AMI SoftHangupRequest, HangupRequest and Hangup events were modified to include the "TechCause" parameter for off-nominal terminations. Like their ARI counterparts, the parameter is suppressed for nominal termination. DeveloperNote: A "tech_cause" parameter has been added to the ChannelHangupRequest and ChannelDestroyed ARI event messages and a "TechCause" parameter has been added to the HangupRequest, SoftHangupRequest and Hangup AMI event messages. For chan_pjsip, these will be set to the last SIP response status code for off-nominally terminated calls. The parameter is suppressed for nominal termination.
This commit is contained in:
		
				
					committed by
					
						![github-actions[bot]](/avatar/af2ab225b7c0eec44a8d0eba6b5c869a?size=40) github-actions[bot]
						github-actions[bot]
					
				
			
			
				
	
			
			
			
						parent
						
							ff0523a3d0
						
					
				
				
					commit
					5766460cc7
				
			| @@ -4197,6 +4197,8 @@ int ast_channel_fdno(const struct ast_channel *chan); | ||||
| void ast_channel_fdno_set(struct ast_channel *chan, int value); | ||||
| int ast_channel_hangupcause(const struct ast_channel *chan); | ||||
| void ast_channel_hangupcause_set(struct ast_channel *chan, int value); | ||||
| int ast_channel_tech_hangupcause(const struct ast_channel *chan); | ||||
| void ast_channel_tech_hangupcause_set(struct ast_channel *chan, int value); | ||||
| int ast_channel_priority(const struct ast_channel *chan); | ||||
| void ast_channel_priority_set(struct ast_channel *chan, int value); | ||||
| int ast_channel_rings(const struct ast_channel *chan); | ||||
|   | ||||
| @@ -132,7 +132,9 @@ struct ast_channel_snapshot_peer { | ||||
|  */ | ||||
| struct ast_channel_snapshot_hangup { | ||||
| 	int cause;      /*!< Why is the channel hanged up. See causes.h */ | ||||
| 	char source[0]; /*!< Who is responsible for hanging up this channel */ | ||||
| 	char *source;   /*!< Who is responsible for hanging up this channel */ | ||||
| 	int tech_cause; /*!< Technology-specific hangup cause */ | ||||
| 	char buffer[0]; /*!< \private Buffer to store source in */ | ||||
| }; | ||||
|  | ||||
| /*! | ||||
|   | ||||
		Reference in New Issue
	
	Block a user