mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 02:37:10 +00:00 
			
		
		
		
	Make SIP INFO messages for dtmf-relay signals case insensitive.
(closes issue ASTERISK-18924) Reported by: Kevin Taylor git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@347292 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		| @@ -10683,14 +10683,20 @@ static int add_digit(struct sip_request *req, char digit, unsigned int duration, | ||||
| 	int event; | ||||
| 	if (mode) { | ||||
| 		/* Application/dtmf short version used by some implementations */ | ||||
| 		if (digit == '*') | ||||
| 		if ('0' <= digit && digit <= '9') { | ||||
| 			event = digit - '0'; | ||||
| 		} else if (digit == '*') { | ||||
| 			event = 10; | ||||
| 		else if (digit == '#') | ||||
| 		} else if (digit == '#') { | ||||
| 			event = 11; | ||||
| 		else if ((digit >= 'A') && (digit <= 'D')) | ||||
| 		} else if ('A' <= digit && digit <= 'D') { | ||||
| 			event = 12 + digit - 'A'; | ||||
| 		else | ||||
| 			event = atoi(&digit); | ||||
| 		} else if ('a' <= digit && digit <= 'd') { | ||||
| 			event = 12 + digit - 'a'; | ||||
| 		} else { | ||||
| 			/* Unknown digit */ | ||||
| 			event = 0; | ||||
| 		} | ||||
| 		snprintf(tmp, sizeof(tmp), "%d\r\n", event); | ||||
| 		add_header(req, "Content-Type", "application/dtmf"); | ||||
| 		add_content(req, tmp); | ||||
| @@ -18537,16 +18543,22 @@ static void handle_request_info(struct sip_pvt *p, struct sip_request *req) | ||||
| 			return; | ||||
| 		} | ||||
| 
 | ||||
| 		if (buf[0] == '*') | ||||
| 		if ('0' <= buf[0] && buf[0] <= '9') { | ||||
| 			event = buf[0] - '0'; | ||||
| 		} else if (buf[0] == '*') { | ||||
| 			event = 10; | ||||
| 		else if (buf[0] == '#') | ||||
| 		} else if (buf[0] == '#') { | ||||
| 			event = 11; | ||||
| 		else if ((buf[0] >= 'A') && (buf[0] <= 'D')) | ||||
| 		} else if ('A' <= buf[0] && buf[0] <= 'D') { | ||||
| 			event = 12 + buf[0] - 'A'; | ||||
| 		else if (buf[0] == '!') | ||||
| 		} else if ('a' <= buf[0] && buf[0] <= 'd') { | ||||
| 			event = 12 + buf[0] - 'a'; | ||||
| 		} else if (buf[0] == '!') { | ||||
| 			event = 16; | ||||
| 		else | ||||
| 			event = atoi(buf); | ||||
| 		} else { | ||||
| 			/* Unknown digit */ | ||||
| 			event = 0; | ||||
| 		} | ||||
| 		if (event == 16) { | ||||
| 			/* send a FLASH event */ | ||||
| 			struct ast_frame f = { AST_FRAME_CONTROL, { AST_CONTROL_FLASH, } }; | ||||
| @@ -18607,6 +18619,9 @@ static void handle_request_info(struct sip_pvt *p, struct sip_request *req) | ||||
| 				f.subclass.integer = '#'; | ||||
| 			} else if (event < 16) { | ||||
| 				f.subclass.integer = 'A' + (event - 12); | ||||
| 			} else { | ||||
| 				/* Unknown digit. */ | ||||
| 				f.subclass.integer = '0'; | ||||
| 			} | ||||
| 			f.len = duration; | ||||
| 			ast_queue_frame(p->owner, &f); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user