mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 18:55:19 +00:00 
			
		
		
		
	chan_pjsip: Add Referred-By header to the PJSIP REFER packet.
Some systems require the REFER packet to include a Referred-By header. If the channel variable SIPREFERREDBYHDR is set, it passes that value as the Referred-By header value. Otherwise, it adds the current dialog’s local info. Reported by: Dan Cropp Tested by: Dan Cropp Change-Id: I3d17912ce548667edf53cb549e88a25475eda245
This commit is contained in:
		
				
					committed by
					
						 Joshua Colp
						Joshua Colp
					
				
			
			
				
	
			
			
			
						parent
						
							74635b5638
						
					
				
				
					commit
					8f777ab584
				
			| @@ -1386,6 +1386,8 @@ static void transfer_refer(struct ast_sip_session *session, const char *target) | ||||
| 	enum ast_control_transfer message = AST_TRANSFER_SUCCESS; | ||||
| 	pj_str_t tmp; | ||||
| 	pjsip_tx_data *packet; | ||||
| 	const char *ref_by_val; | ||||
| 	char local_info[pj_strlen(&session->inv_session->dlg->local.info_str) + 1]; | ||||
|  | ||||
| 	if (pjsip_xfer_create_uac(session->inv_session->dlg, NULL, &sub) != PJ_SUCCESS) { | ||||
| 		message = AST_TRANSFER_FAILED; | ||||
| @@ -1402,6 +1404,14 @@ static void transfer_refer(struct ast_sip_session *session, const char *target) | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	ref_by_val = pbx_builtin_getvar_helper(session->channel, "SIPREFERREDBYHDR"); | ||||
| 	if (!ast_strlen_zero(ref_by_val)) { | ||||
| 		ast_sip_add_header(packet, "Referred-By", ref_by_val); | ||||
| 	} else { | ||||
| 		ast_copy_pj_str(local_info, &session->inv_session->dlg->local.info_str, sizeof(local_info)); | ||||
| 		ast_sip_add_header(packet, "Referred-By", local_info); | ||||
| 	} | ||||
|  | ||||
| 	pjsip_xfer_send_request(sub, packet); | ||||
| 	ast_queue_control_data(session->channel, AST_CONTROL_TRANSFER, &message, sizeof(message)); | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user