[asterisk-commits] branch crichter/0.4.0 r31439 - in /team/crichter/0.4.0: ./ apps/ channels/ ch...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Jun 1 10:12:03 MST 2006


Author: crichter
Date: Thu Jun  1 12:12:03 2006
New Revision: 31439

URL: http://svn.digium.com/view/asterisk?rev=31439&view=rev
Log:
Merged revisions 29961,29976,30043,30073,30103,30246,30302,30332,30395,30433,30550,30773,30808,30878,31132,31166,31198,31323 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/team/crichter/0.3.0

........
r29961 | root | 2006-05-24 15:00:29 +0200 (Mi, 24 Mai 2006) | 1 line

automerge commit
........
r29976 | root | 2006-05-24 19:00:39 +0200 (Mi, 24 Mai 2006) | 1 line

automerge commit
........
r30043 | root | 2006-05-24 22:00:38 +0200 (Mi, 24 Mai 2006) | 1 line

automerge commit
........
r30073 | root | 2006-05-24 23:00:38 +0200 (Mi, 24 Mai 2006) | 1 line

automerge commit
........
r30103 | root | 2006-05-25 00:00:35 +0200 (Do, 25 Mai 2006) | 1 line

automerge commit
........
r30246 | root | 2006-05-25 18:00:36 +0200 (Do, 25 Mai 2006) | 1 line

automerge commit
........
r30302 | root | 2006-05-25 20:00:37 +0200 (Do, 25 Mai 2006) | 1 line

automerge commit
........
r30332 | root | 2006-05-25 21:00:36 +0200 (Do, 25 Mai 2006) | 1 line

automerge commit
........
r30395 | root | 2006-05-25 23:00:56 +0200 (Do, 25 Mai 2006) | 1 line

automerge commit
........
r30433 | root | 2006-05-26 00:00:37 +0200 (Fr, 26 Mai 2006) | 1 line

automerge commit
........
r30550 | root | 2006-05-26 20:00:30 +0200 (Fr, 26 Mai 2006) | 1 line

automerge commit
........
r30773 | root | 2006-05-30 17:00:41 +0200 (Di, 30 Mai 2006) | 1 line

automerge commit
........
r30808 | root | 2006-05-30 19:00:24 +0200 (Di, 30 Mai 2006) | 1 line

automerge commit
........
r30878 | root | 2006-05-30 22:00:25 +0200 (Di, 30 Mai 2006) | 1 line

automerge commit
........
r31132 | root | 2006-05-31 23:00:40 +0200 (Mi, 31 Mai 2006) | 1 line

automerge commit
........
r31166 | root | 2006-06-01 01:00:34 +0200 (Do, 01 Jun 2006) | 1 line

automerge commit
........
r31198 | root | 2006-06-01 02:00:36 +0200 (Do, 01 Jun 2006) | 1 line

automerge commit
........
r31323 | crichter | 2006-06-01 14:48:42 +0200 (Do, 01 Jun 2006) | 1 line

added bearer capability reject support. we send release instead of disconnect in case we have no real channel yet. added support for Restarting channels added support for sending complete decoding. changed some log levels.
........

Modified:
    team/crichter/0.4.0/   (props changed)
    team/crichter/0.4.0/apps/app_dial.c
    team/crichter/0.4.0/apps/app_meetme.c
    team/crichter/0.4.0/apps/app_queue.c
    team/crichter/0.4.0/channels/chan_misdn.c
    team/crichter/0.4.0/channels/chan_sip.c
    team/crichter/0.4.0/channels/chan_zap.c
    team/crichter/0.4.0/channels/misdn/chan_misdn_config.h
    team/crichter/0.4.0/channels/misdn/ie.c
    team/crichter/0.4.0/channels/misdn/isdn_lib.c
    team/crichter/0.4.0/channels/misdn/isdn_lib.h
    team/crichter/0.4.0/channels/misdn/isdn_msg_parser.c
    team/crichter/0.4.0/channels/misdn_config.c
    team/crichter/0.4.0/codecs/gsm/Makefile
    team/crichter/0.4.0/configs/extensions.conf.sample
    team/crichter/0.4.0/configs/misdn.conf.sample
    team/crichter/0.4.0/logger.c
    team/crichter/0.4.0/res/res_agi.c
    team/crichter/0.4.0/rtp.c

Propchange: team/crichter/0.4.0/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Jun  1 12:12:03 2006
@@ -1,1 +1,1 @@
-/team/crichter/0.3.0:1-29949
+/team/crichter/0.3.0:1-31324

Modified: team/crichter/0.4.0/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/apps/app_dial.c?rev=31439&r1=31438&r2=31439&view=diff
==============================================================================
--- team/crichter/0.4.0/apps/app_dial.c (original)
+++ team/crichter/0.4.0/apps/app_dial.c Thu Jun  1 12:12:03 2006
@@ -939,20 +939,26 @@
 		}
 		
 		if( privdb_val == AST_PRIVACY_DENY ) {
+			strcpy(status, "NOANSWER");
 			ast_verbose( VERBOSE_PREFIX_3  "Privacy DB reports PRIVACY_DENY for this callerid. Dial reports unavailable\n");
 			res=0;
 			goto out;
 		}
 		else if( privdb_val == AST_PRIVACY_KILL ) {
-			ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 201);
+			strcpy(status, "DONTCALL");
+			if (option_priority_jumping || ast_test_flag(&opts, OPT_PRIORITY_JUMP)) {
+				ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 201);
+			}
 			res = 0;
 			goto out; /* Is this right? */
 		}
 		else if( privdb_val == AST_PRIVACY_TORTURE ) {
-			ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 301);
+			strcpy(status, "TORTURE");
+			if (option_priority_jumping || ast_test_flag(&opts, OPT_PRIORITY_JUMP)) {
+				ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 301);
+			}
 			res = 0;
 			goto out; /* is this right??? */
-
 		}
 		else if( privdb_val == AST_PRIVACY_UNKNOWN ) {
 			/* Get the user's intro, store it in priv-callerintros/$CID, 
@@ -1310,6 +1316,7 @@
 								     opt_args[OPT_ARG_PRIVACY], privcid);
 						ast_privacy_set(opt_args[OPT_ARG_PRIVACY], privcid, AST_PRIVACY_DENY);
 					}
+					strcpy(status,"NOANSWER");
 					if (ast_test_flag(&opts, OPT_MUSICBACK)) {
 						ast_moh_stop(chan);
 					} else if (ast_test_flag(&opts, OPT_RINGBACK)) {

Modified: team/crichter/0.4.0/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/apps/app_meetme.c?rev=31439&r1=31438&r2=31439&view=diff
==============================================================================
--- team/crichter/0.4.0/apps/app_meetme.c (original)
+++ team/crichter/0.4.0/apps/app_meetme.c Thu Jun  1 12:12:03 2006
@@ -165,7 +165,7 @@
 	int talking;				/* Is user talking */
 	int zapchannel;				/* Is a Zaptel channel */
 	char usrvalue[50];			/* Custom User Value */
-	char namerecloc[AST_MAX_EXTENSION];	/* Name Recorded file Location */
+	char namerecloc[PATH_MAX];	/* Name Recorded file Location */
 	time_t jointime;			/* Time the user joined the conference */
 	struct volume talk;
 	struct volume listen;
@@ -1069,7 +1069,7 @@
 	if (!firstpass && !(confflags & CONFFLAG_MONITOR) && !(confflags & CONFFLAG_ADMIN)) {
 		firstpass = 1;
 		if (!(confflags & CONFFLAG_QUIET))
-			if (!(confflags & CONFFLAG_WAITMARKED) || (conf->markedusers >= 1))
+			if (!(confflags & CONFFLAG_WAITMARKED) || ((confflags & CONFFLAG_MARKEDUSER) && (conf->markedusers >= 1)))
 				conf_play(chan, conf, ENTER);
 	}
 

Modified: team/crichter/0.4.0/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/apps/app_queue.c?rev=31439&r1=31438&r2=31439&view=diff
==============================================================================
--- team/crichter/0.4.0/apps/app_queue.c (original)
+++ team/crichter/0.4.0/apps/app_queue.c Thu Jun  1 12:12:03 2006
@@ -303,6 +303,13 @@
 	struct member *next;		/*!< Next member */
 };
 
+struct ast_member_interfaces {
+	char interface[80];
+	AST_LIST_ENTRY(ast_member_interfaces) list;    /*!< Next call queue */
+};
+
+static AST_LIST_HEAD_STATIC(interfaces, ast_member_interfaces);
+
 /* values used in multi-bit flags in ast_call_queue */
 #define QUEUE_EMPTY_NORMAL 1
 #define QUEUE_EMPTY_STRICT 2
@@ -458,6 +465,7 @@
 	struct ast_call_queue *q;
 	struct statechange *sc = data;
 	struct member *cur;
+	struct ast_member_interfaces *curint;
 	char *loc;
 	char *technology;
 
@@ -470,36 +478,50 @@
 		free(sc);
 		return NULL;
 	}
-	if (option_debug)
-		ast_log(LOG_DEBUG, "Device '%s/%s' changed to state '%d' (%s)\n", technology, loc, sc->state, devstate2str(sc->state));
-	ast_mutex_lock(&qlock);
-	for (q = queues; q; q = q->next) {
-		ast_mutex_lock(&q->lock);
-		cur = q->members;
-		while(cur) {
-			if (!strcasecmp(sc->dev, cur->interface)) {
-				if (cur->status != sc->state) {
-					cur->status = sc->state;
-					if (!q->maskmemberstatus) {
-						manager_event(EVENT_FLAG_AGENT, "QueueMemberStatus",
-							"Queue: %s\r\n"
-							"Location: %s\r\n"
-							"Membership: %s\r\n"
-							"Penalty: %d\r\n"
-							"CallsTaken: %d\r\n"
-							"LastCall: %d\r\n"
-							"Status: %d\r\n"
-							"Paused: %d\r\n",
-						q->name, cur->interface, cur->dynamic ? "dynamic" : "static",
-						cur->penalty, cur->calls, (int)cur->lastcall, cur->status, cur->paused);
+
+	AST_LIST_LOCK(&interfaces);
+	AST_LIST_TRAVERSE(&interfaces, curint, list) {
+		if (!strcasecmp(curint->interface, sc->dev))
+			break;
+	}
+	AST_LIST_UNLOCK(&interfaces);
+	
+	if (curint) {
+
+		if (option_debug)
+			ast_log(LOG_DEBUG, "Device '%s/%s' changed to state '%d' (%s)\n", technology, loc, sc->state, devstate2str(sc->state));
+		ast_mutex_lock(&qlock);
+		for (q = queues; q; q = q->next) {
+			ast_mutex_lock(&q->lock);
+			cur = q->members;
+			while(cur) {
+				if (!strcasecmp(sc->dev, cur->interface)) {
+					if (cur->status != sc->state) {
+						cur->status = sc->state;
+						if (!q->maskmemberstatus) {
+							manager_event(EVENT_FLAG_AGENT, "QueueMemberStatus",
+								"Queue: %s\r\n"
+								"Location: %s\r\n"
+								"Membership: %s\r\n"
+								"Penalty: %d\r\n"
+								"CallsTaken: %d\r\n"
+								"LastCall: %d\r\n"
+								"Status: %d\r\n"
+								"Paused: %d\r\n",
+							q->name, cur->interface, cur->dynamic ? "dynamic" : "static",
+							cur->penalty, cur->calls, (int)cur->lastcall, cur->status, cur->paused);
+						}
 					}
 				}
-			}
-			cur = cur->next;
-		}
-		ast_mutex_unlock(&q->lock);
-	}
-	ast_mutex_unlock(&qlock);
+				cur = cur->next;
+			}
+			ast_mutex_unlock(&q->lock);
+		}
+		ast_mutex_unlock(&qlock);
+	} else {
+		if (option_debug)
+			ast_log(LOG_DEBUG, "Device '%s/%s' changed to state '%d' (%s) but we don't care because they're not a member of any queue.\n", technology, loc, sc->state, devstate2str(sc->state));
+        }
 	free(sc);
 	return NULL;
 }
@@ -594,6 +616,99 @@
 	q->callsabandoned = 0;
 	q->callscompletedinsl = 0;
 	q->wrapuptime = 0;
+}
+
+static int add_to_interfaces(char *interface) 
+{
+	struct ast_member_interfaces *curint, *newint;
+
+	if (!interface)
+		return 0;
+
+	AST_LIST_LOCK(&interfaces);
+	AST_LIST_TRAVERSE(&interfaces, curint, list) {
+		if (!strcasecmp(curint->interface, interface))
+			break; 
+	}
+
+	if (!curint) {
+		if (option_debug)
+			ast_log(LOG_DEBUG, "Adding %s to the list of interfaces that make up all of our queue members.\n", interface);
+
+	        if ((newint = malloc(sizeof(*newint)))) {
+			memset(newint, 0, sizeof(*newint));
+			ast_copy_string(newint->interface, interface, sizeof(newint->interface));
+			AST_LIST_INSERT_HEAD(&interfaces, newint, list);
+		}
+	}
+	AST_LIST_UNLOCK(&interfaces);
+
+ return 0;
+}
+
+static int interface_exists_global(char *interface)
+{
+	struct ast_call_queue *q;
+	struct member *mem;
+	int ret = 0;
+
+	if (!interface)
+		return ret;
+
+	ast_mutex_lock(&qlock);
+	for (q = queues; q && !ret; q = q->next) {
+		ast_mutex_lock(&q->lock);
+		mem = q->members;
+		while(mem) {
+			if (!strcasecmp(interface, mem->interface)) {
+				ret = 1;
+				break;
+			}
+			mem = mem->next;
+		}
+		ast_mutex_unlock(&q->lock);
+	}
+	ast_mutex_unlock(&qlock);
+
+	return ret;
+}
+
+
+static int remove_from_interfaces(char *interface)
+{
+	struct ast_member_interfaces *curint;
+
+	if (!interface)
+		return 0;
+
+	AST_LIST_LOCK(&interfaces);
+	AST_LIST_TRAVERSE_SAFE_BEGIN(&interfaces, curint, list) {
+		if (!strcasecmp(curint->interface, interface) && !interface_exists_global(interface)) {
+			if (option_debug)
+				ast_log(LOG_DEBUG, "Removing %s from the list of interfaces that make up all of our queue members.\n", interface);
+			AST_LIST_REMOVE_CURRENT(&interfaces, list);
+			free(curint);
+		}
+	}
+	AST_LIST_TRAVERSE_SAFE_END;
+	AST_LIST_UNLOCK(&interfaces);
+
+ 	return 0;
+}
+
+static void clear_and_free_interfaces(void)
+{
+	struct ast_member_interfaces *curint;
+
+	AST_LIST_LOCK(&interfaces);
+	AST_LIST_TRAVERSE_SAFE_BEGIN(&interfaces, curint, list) {
+		AST_LIST_REMOVE_CURRENT(&interfaces, list);
+		free(curint);
+	}
+	AST_LIST_TRAVERSE_SAFE_END;
+	AST_LIST_UNLOCK(&interfaces);
+
+ 	return;
 }
 
 /*! \brief Configure a queue parameter.
@@ -746,6 +861,7 @@
 		m = create_queue_member(interface, penalty, 0);
 		if (m) {
 			m->dead = 0;
+			add_to_interfaces(interface);
 			if (prev_m) {
 				prev_m->next = m;
 			} else {
@@ -770,6 +886,7 @@
 				prev->next = next;
 			else
 				q->members = next;
+			remove_from_interfaces(curm->interface);
 			free(curm);
 		} else 
 			prev = curm;
@@ -917,6 +1034,7 @@
 			} else {
 				q->members = next_m;
 			}
+			remove_from_interfaces(m->interface);
 			free(m);
 		} else {
 			prev_m = m;
@@ -1033,9 +1151,9 @@
 			      qe->chan->cid.cid_num ? qe->chan->cid.cid_num : "unknown",
 			      qe->chan->cid.cid_name ? qe->chan->cid.cid_name : "unknown",
 			      q->name, qe->pos, q->count );
-#if 0
-ast_log(LOG_NOTICE, "Queue '%s' Join, Channel '%s', Position '%d'\n", q->name, qe->chan->name, qe->pos );
-#endif
+
+		if (option_debug)
+			ast_log(LOG_DEBUG, "Queue '%s' Join, Channel '%s', Position '%d'\n", q->name, qe->chan->name, qe->pos );
 	}
 	ast_mutex_unlock(&q->lock);
 	ast_mutex_unlock(&qlock);
@@ -1181,13 +1299,16 @@
 		ast_verbose(VERBOSE_PREFIX_3 "Told %s in %s their queue position (which was %d)\n",
 			    qe->chan->name, qe->parent->name, qe->pos);
 	res = play_file(qe->chan, qe->parent->sound_thanks);
+	if (res && !valid_exit(qe, res))
+		res = 0;
 
  playout:
 	/* Set our last_pos indicators */
  	qe->last_pos = now;
 	qe->last_pos_said = qe->pos;
+
 	/* Don't restart music on hold if we're about to exit the caller from the queue */
-	if (res)
+	if (!res)
 		ast_moh_start(qe->chan, qe->moh);
 
 	return res;
@@ -1556,7 +1677,7 @@
 	if (!res) {
 		/* Wait for a keypress */
 		res = ast_waitstream(chan, AST_DIGIT_ANY);
-		if (res <= 0 || !valid_exit(qe, res))
+		if (res < 0 || !valid_exit(qe, res))
 			res = 0;
 
 		/* Stop playback */
@@ -1594,8 +1715,9 @@
 	/* play the announcement */
 	res = background_file(qe, qe->chan, qe->parent->sound_periodicannounce);
 
-	/* Resume Music on Hold */
-	ast_moh_start(qe->chan, qe->moh);
+	/* Resume Music on Hold if the caller is going to stay in the queue */
+	if (!res)
+		ast_moh_start(qe->chan, qe->moh);
 
 	/* update last_periodic_announce_time */
 	qe->last_periodic_announce_time = now;
@@ -1920,18 +2042,17 @@
 		}
 
 		/* Make a position announcement, if enabled */
-		if (qe->parent->announcefrequency && !ringing)
-			res = say_position(qe);
-		if (res)
+		if (qe->parent->announcefrequency && !ringing &&
+		    (res = say_position(qe)))
 			break;
 
 		/* Make a periodic announcement, if enabled */
-		if (qe->parent->periodicannouncefrequency && !ringing)
-			res = say_periodic_announcement(qe);
+		if (qe->parent->periodicannouncefrequency && !ringing &&
+		    (res = say_periodic_announcement(qe)))
+			break;
 
 		/* Wait a second before checking again */
-		if (!res) res = ast_waitfordigit(qe->chan, RECHECK * 1000);
-		if (res)
+		if ((res = ast_waitfordigit(qe->chan, RECHECK * 1000)))
 			break;
 	}
 	return res;
@@ -2230,7 +2351,7 @@
 		if (res < 0) {
 			ast_queue_log(queuename, qe->chan->uniqueid, peer->name, "SYSCOMPAT", "%s", "");
 			ast_log(LOG_WARNING, "Had to drop call because I couldn't make %s compatible with %s\n", qe->chan->name, peer->name);
-		record_abandoned(qe);
+			record_abandoned(qe);
 			ast_hangup(peer);
 			return -1;
 		}
@@ -2307,13 +2428,10 @@
 					      (long)(time(NULL) - callstart));
 		}
 
-		if(bridge != AST_PBX_NO_HANGUP_PEER)
+		if (bridge != AST_PBX_NO_HANGUP_PEER)
 			ast_hangup(peer);
 		update_queue(qe->parent, member);
-		if (bridge == 0) 
-			res = 1; /* JDG: bridge successfull, leave app_queue */
-		else 
-			res = bridge; /* bridge error, stay in the queue */
+		res = bridge ? -1 : 0;
 	}	
 out:
 	hangupcalls(outgoing, NULL);
@@ -2421,6 +2539,8 @@
 		}
 		ast_mutex_unlock(&q->lock);
 	}
+	if (res == RES_OKAY)
+		remove_from_interfaces(interface);
 	ast_mutex_unlock(&qlock);
 	return res;
 }
@@ -2440,6 +2560,9 @@
 	if (q) {
 		ast_mutex_lock(&q->lock);
 		if (interface_exists(q, interface) == NULL) {
+
+			add_to_interfaces(interface);
+
 			new_member = create_queue_member(interface, penalty, paused);
 
 			if (new_member != NULL) {
@@ -2991,9 +3114,8 @@
 
 				if (makeannouncement) {
 					/* Make a position announcement, if enabled */
-					if (qe.parent->announcefrequency && !ringing)
-						res = say_position(&qe);
-					if (res) {
+					if (qe.parent->announcefrequency && !ringing &&
+					    (res = say_position(&qe))) {
 						ast_queue_log(queuename, chan->uniqueid, "NONE", "EXITWITHKEY", "%s|%d", qe.digits, qe.pos);
 						break;
 					}
@@ -3002,10 +3124,8 @@
 				makeannouncement = 1;
 
 				/* Make a periodic announcement, if enabled */
-				if (qe.parent->periodicannouncefrequency && !ringing)
-					res = say_periodic_announcement(&qe);
-
-				if (res && valid_exit(&qe, res)) {
+				if (qe.parent->periodicannouncefrequency && !ringing &&
+				    (res = say_periodic_announcement(&qe))) {
 					ast_queue_log(queuename, chan->uniqueid, "NONE", "EXITWITHKEY", "%c|%d", res, qe.pos);
 					break;
 				}
@@ -3018,8 +3138,9 @@
 							record_abandoned(&qe);
 							ast_queue_log(queuename, chan->uniqueid, "NONE", "ABANDON", "%d|%d|%ld", qe.pos, qe.opos, (long)time(NULL) - qe.start);
 						}
-					} else if (res > 0)
+					} else if (valid_exit(&qe, res)) {
 						ast_queue_log(queuename, chan->uniqueid, "NONE", "EXITWITHKEY", "%s|%d", qe.digits, qe.pos);
+					}
 					break;
 				}
 
@@ -3082,7 +3203,7 @@
 				if (!is_our_turn(&qe)) {
 					if (option_debug)
 						ast_log(LOG_DEBUG, "Darn priorities, going back in queue (%s)!\n",
-								qe.chan->name);
+							qe.chan->name);
 					goto check_turns;
 				}
 			}
@@ -3253,6 +3374,8 @@
 							}
 							free(cur);
 						} else {
+							/* Add them to the master int list if necessary */
+							add_to_interfaces(interface);
 							newm->next = q->members;
 							q->members = newm;
 						}
@@ -3277,6 +3400,7 @@
 							q->members = cur->next;
 							newm = cur;
 						}
+						remove_from_interfaces(cur->interface);
 					}
 				}
 				if (!new) 
@@ -3829,6 +3953,7 @@
 {
 	int res;
 
+	clear_and_free_interfaces();
 	res = ast_cli_unregister(&cli_show_queue);
 	res |= ast_cli_unregister(&cli_show_queues);
 	res |= ast_cli_unregister(&cli_add_queue_member);

Modified: team/crichter/0.4.0/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/channels/chan_misdn.c?rev=31439&r1=31438&r2=31439&view=diff
==============================================================================
--- team/crichter/0.4.0/channels/chan_misdn.c (original)
+++ team/crichter/0.4.0/channels/chan_misdn.c Thu Jun  1 12:12:03 2006
@@ -150,6 +150,8 @@
   
 	ast_mutex_t lock;
 
+	char allowed_bearers[BUFFERSIZE+1];
+	
 	enum misdn_chan_state state;
 	int holded; 
 	int orginator;
@@ -346,12 +348,28 @@
 }
 
 
+
+struct allowed_bearers {
+	int cap;
+	int val;
+	char *name;
+};
+
+struct allowed_bearers allowed_bearers_array[]={
+	{INFO_CAPABILITY_SPEECH,1,"speech"},
+	{INFO_CAPABILITY_AUDIO_3_1K,2,"3_1khz"},
+	{INFO_CAPABILITY_DIGITAL_UNRESTRICTED,4,"digital_unrestricted"},
+	{INFO_CAPABILITY_DIGITAL_RESTRICTED,8,"digital_restriced"},
+	{INFO_CAPABILITY_VIDEO,16,"video"}
+};
+
 static char *bearer2str(int cap) {
 	static char *bearers[]={
 		"Speech",
 		"Audio 3.1k",
 		"Unres Digital",
 		"Res Digital",
+		"Video",
 		"Unknown Bearer"
 	};
 	
@@ -368,8 +386,11 @@
 	case INFO_CAPABILITY_DIGITAL_RESTRICTED:
 		return bearers[3];
 		break;
+	case INFO_CAPABILITY_VIDEO:
+		return bearers[4];
+		break;
 	default:
-		return bearers[4];
+		return bearers[5];
 		break;
 	}
 }
@@ -1243,7 +1264,7 @@
 	struct misdn_bchannel *bc=ch->bc;
 	int len=ch->jb_len, threshold=ch->jb_upper_threshold;
 	
-	chan_misdn_log(1,bc->port, "config_jb: Called\n");
+	chan_misdn_log(5,bc->port, "config_jb: Called\n");
 	
 	if ( ! len ) {
 		chan_misdn_log(1,bc->port, "config_jb: Deactivating Jitterbuffer\n");
@@ -1294,6 +1315,10 @@
 		break;
 	}
 }
+
+
+
+
 
 static int read_config(struct chan_list *ch, int orig) {
 
@@ -1311,7 +1336,7 @@
 	
 	int port=bc->port;
 	
-	chan_misdn_log(1,port,"read_config: Getting Config\n");
+	chan_misdn_log(5,port,"read_config: Getting Config\n");
 	
 	char lang[BUFFERSIZE+1];
 
@@ -1333,6 +1358,9 @@
 	misdn_cfg_get( port, MISDN_CFG_NEED_MORE_INFOS, &bc->need_more_infos, sizeof(int));
 	
 	misdn_cfg_get( port, MISDN_CFG_FAR_ALERTING, &ch->far_alerting, sizeof(int));
+
+	misdn_cfg_get( port, MISDN_CFG_ALLOWED_BEARERS, &ch->allowed_bearers, BUFFERSIZE);
+	
 	
 	int hdlc=0;
 	misdn_cfg_get( port, MISDN_CFG_HDLC, &hdlc, sizeof(int));
@@ -1392,7 +1420,7 @@
 		misdn_cfg_get(port, MISDN_CFG_PICKUPGROUP, &pg, sizeof(pg));
 		misdn_cfg_get(port, MISDN_CFG_CALLGROUP, &cg, sizeof(cg));
 		
-		chan_misdn_log(2, port, " --> * CallGrp:%s PickupGrp:%s\n",ast_print_group(buf,sizeof(buf),cg),ast_print_group(buf,sizeof(buf),pg));
+		chan_misdn_log(5, port, " --> * CallGrp:%s PickupGrp:%s\n",ast_print_group(buf,sizeof(buf),cg),ast_print_group(buf,sizeof(buf),pg));
 		ast->pickupgroup=pg;
 		ast->callgroup=cg;
 	}
@@ -2178,18 +2206,20 @@
 	int bridging;
 	misdn_cfg_get( 0, MISDN_GEN_BRIDGING, &bridging, sizeof(int));
 	if (bridging) {
-		int ecwb;
+		int ecwb, ec;
 		misdn_cfg_get( ch1->bc->port, MISDN_CFG_ECHOCANCELWHENBRIDGED, &ecwb, sizeof(int));
-		if ( !ecwb ) {
+		misdn_cfg_get( ch1->bc->port, MISDN_CFG_ECHOCANCEL, &ec, sizeof(int));
+		if ( !ecwb && ec ) {
 			chan_misdn_log(2, ch1->bc->port, "Disabling Echo Cancellor when Bridged\n");
 			ch1->bc->ec_enable=0;
-		/*	manager_ec_disable(ch1->bc); */
+			manager_ec_disable(ch1->bc);
 		}
 		misdn_cfg_get( ch2->bc->port, MISDN_CFG_ECHOCANCELWHENBRIDGED, &ecwb, sizeof(int));
-		if ( !ecwb ) {
+		misdn_cfg_get( ch2->bc->port, MISDN_CFG_ECHOCANCEL, &ec, sizeof(int));
+		if ( !ecwb && ec) {
 			chan_misdn_log(2, ch2->bc->port, "Disabling Echo Cancellor when Bridged\n");
 			ch2->bc->ec_enable=0;
-		/*	manager_ec_disable(ch2->bc); */
+			manager_ec_disable(ch2->bc); 
 		}
 		
 		/* trying to make a mISDN_dsp conference */
@@ -2238,7 +2268,7 @@
 	const struct tone_zone_sound *ts= NULL;
 	struct ast_channel *ast=cl->ast;
 	
-	chan_misdn_log(2,cl->bc->port,"Tone Indicate:\n");
+	chan_misdn_log(3,cl->bc->port,"Tone Indicate:\n");
 	
 	if (!cl->ast) {
 		return 0;
@@ -2246,24 +2276,24 @@
 	
 	switch (tone) {
 	case TONE_DIAL:
-		chan_misdn_log(2,cl->bc->port," --> Dial\n");
+		chan_misdn_log(3,cl->bc->port," --> Dial\n");
 		ts=ast_get_indication_tone(ast->zone,"dial");
 		misdn_lib_tone_generator_start(cl->bc);
 		break;
 	case TONE_ALERTING:
-		chan_misdn_log(2,cl->bc->port," --> Ring\n");
+		chan_misdn_log(3,cl->bc->port," --> Ring\n");
 		ts=ast_get_indication_tone(ast->zone,"ring");
 		misdn_lib_tone_generator_stop(cl->bc);
 		break;
 	case TONE_FAR_ALERTING:
 	/* VERY UGLY HACK, BECAUSE CHAN_SIP DOES NOT GENERATE TONES */
-		chan_misdn_log(2,cl->bc->port," --> Ring\n");
+		chan_misdn_log(3,cl->bc->port," --> Ring\n");
 		ts=ast_get_indication_tone(ast->zone,"ring");
 		misdn_lib_tone_generator_start(cl->bc);
 		misdn_lib_echo(cl->bc,1);
 		break;
 	case TONE_BUSY:
-		chan_misdn_log(2,cl->bc->port," --> Busy\n");
+		chan_misdn_log(3,cl->bc->port," --> Busy\n");
 		ts=ast_get_indication_tone(ast->zone,"busy");
 		misdn_lib_tone_generator_stop(cl->bc);
 		break;
@@ -2271,7 +2301,7 @@
 		break;
 
 	case TONE_NONE:
-		chan_misdn_log(2,cl->bc->port," --> None\n");
+		chan_misdn_log(3,cl->bc->port," --> None\n");
 		misdn_lib_tone_generator_stop(cl->bc);
 		ast_playtones_stop(ast);
 		break;
@@ -2779,8 +2809,8 @@
 		} 
 		release_unlock;
 		
-		chan_misdn_log(1, bc->port, "Trying to Release bc with l3id: %x\n",bc->l3_id);
-
+		chan_misdn_log(1, bc->port, "release_chan: bc with l3id: %x\n",bc->l3_id);
+		
 		//releaseing jitterbuffer
 		if (ch->jb ) {
 			misdn_jb_destroy(ch->jb);
@@ -3319,6 +3349,24 @@
 
 		/** queue new chan **/
 		cl_queue_chan(&cl_te, ch) ;
+
+
+		if (!strstr(ch->allowed_bearers,"all")) {
+			int i;
+			for (i=0; i< sizeof(allowed_bearers_array)/sizeof(struct allowed_bearers); i++) {
+				if (allowed_bearers_array[i].cap == bc->capability) {
+					if (  !strstr( ch->allowed_bearers, allowed_bearers_array[i].name)) {
+						chan_misdn_log(0,bc->port,"Bearer Not allowed\b");
+						bc->out_cause=88;
+						
+						ch->state=MISDN_EXTCANTMATCH;
+						misdn_lib_send_event(bc, EVENT_RELEASE_COMPLETE );
+						return RESPONSE_OK;
+					}
+				}
+				
+			}
+		}
 		
 		/* Check for Pickup Request first */
 		if (!strcmp(chan->exten, ast_pickup_ext())) {
@@ -3374,7 +3422,8 @@
 			if (bc->nt)
 				misdn_lib_send_event(bc, EVENT_RELEASE_COMPLETE );
 			else
-				misdn_lib_send_event(bc, EVENT_DISCONNECT );
+				misdn_lib_send_event(bc, EVENT_RELEASE );
+				
 			break;
 		}
 		
@@ -3398,26 +3447,34 @@
 				if (bc->nt)
 					misdn_lib_send_event(bc, EVENT_RELEASE_COMPLETE );
 				else
-					misdn_lib_send_event(bc, EVENT_DISCONNECT );
+					misdn_lib_send_event(bc, EVENT_RELEASE);
 			}
 		} else {
-			int ret= misdn_lib_send_event(bc, EVENT_SETUP_ACKNOWLEDGE );
-			if (ret == -ENOCHAN) {
-				ast_log(LOG_WARNING,"Channel was catched, before we could Acknowledge\n");
-				misdn_lib_send_event(bc,EVENT_RELEASE_COMPLETE);
+
+
+			if (bc->sending_complete) {
+				bc->out_cause=1;
+				misdn_lib_send_event(bc, EVENT_RELEASE);
+			} else {
+				
+				int ret= misdn_lib_send_event(bc, EVENT_SETUP_ACKNOWLEDGE );
+				if (ret == -ENOCHAN) {
+					ast_log(LOG_WARNING,"Channel was catched, before we could Acknowledge\n");
+					misdn_lib_send_event(bc,EVENT_RELEASE_COMPLETE);
+				}
+				/*  send tone to phone :) */
+				
+				/** ADD IGNOREPAT **/
+				
+				int stop_tone;
+				misdn_cfg_get( 0, MISDN_GEN_STOP_TONE, &stop_tone, sizeof(int));
+				if ( (!ast_strlen_zero(bc->dad)) && stop_tone ) 
+					tone_indicate(ch,TONE_NONE);
+				else
+					tone_indicate(ch,TONE_DIAL);
+				
+				ch->state=MISDN_WAITING4DIGS;
 			}
-			/*  send tone to phone :) */
-
-			/** ADD IGNOREPAT **/
-			
-			int stop_tone;
-			misdn_cfg_get( 0, MISDN_GEN_STOP_TONE, &stop_tone, sizeof(int));
-			if ( (!ast_strlen_zero(bc->dad)) && stop_tone ) 
-				tone_indicate(ch,TONE_NONE);
-			else
-				tone_indicate(ch,TONE_DIAL);
-			
-			ch->state=MISDN_WAITING4DIGS;
 		}
       
 	}
@@ -3785,8 +3842,11 @@
 		
 		break;
 
-
 	case EVENT_RESTART:
+
+		stop_bc_tones(ch);
+		release_chan(bc);
+		
 		break;
 				
 	default:

Modified: team/crichter/0.4.0/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/channels/chan_sip.c?rev=31439&r1=31438&r2=31439&view=diff
==============================================================================
--- team/crichter/0.4.0/channels/chan_sip.c (original)
+++ team/crichter/0.4.0/channels/chan_sip.c Thu Jun  1 12:12:03 2006
@@ -530,7 +530,7 @@
 #define SIP_USECLIENTCODE	(1 << 12)	/*!< Trust X-ClientCode info message */
 #define SIP_OUTGOING		(1 << 13)	/*!< Is this an outgoing call? */
 #define SIP_SELFDESTRUCT	(1 << 14)	/*!< This is an autocreated peer */
-#define SIP_DYNAMIC		(1 << 15)	/*!< Is this a dynamic peer? */
+#define SIP_CAN_BYE		(1 << 15)	/*!< Can we send BYE for this dialog? */
 /* --- Choices for DTMF support in SIP channel */
 #define SIP_DTMF		(3 << 16)	/*!< three settings, uses two bits */
 #define SIP_DTMF_RFC2833	(0 << 16)	/*!< RTP DTMF */
@@ -580,6 +580,7 @@
 #define SIP_PAGE2_RTAUTOCLEAR		(1 << 2)
 #define SIP_PAGE2_IGNOREREGEXPIRE	(1 << 3)
 #define SIP_PAGE2_RT_FROMCONTACT 	(1 << 4)
+#define SIP_PAGE2_DYNAMIC		(1 << 5)	/*!< Is this a dynamic peer? */
 
 /* SIP packet flags */
 #define SIP_PKT_DEBUG		(1 << 0)	/*!< Debug this packet */
@@ -2456,12 +2457,18 @@
 				/* stop retransmitting an INVITE that has not received a response */
 				__sip_pretend_ack(p);
 
-				/* Send a new request: CANCEL */
-				transmit_request_with_auth(p, SIP_CANCEL, p->ocseq, 1, 0);
-				/* Actually don't destroy us yet, wait for the 487 on our original 
-				   INVITE, but do set an autodestruct just in case we never get it. */
-				ast_clear_flag(&locflags, SIP_NEEDDESTROY);
-				sip_scheddestroy(p, 32000);
+				/* are we allowed to send CANCEL yet? if not, mark
+				   it pending */
+				if (!ast_test_flag(p, SIP_CAN_BYE)) {
+					ast_set_flag(p, SIP_PENDINGBYE);
+				} else {
+					/* Send a new request: CANCEL */
+					transmit_request_with_auth(p, SIP_CANCEL, p->ocseq, 1, 0);
+					/* Actually don't destroy us yet, wait for the 487 on our original 
+					   INVITE, but do set an autodestruct just in case we never get it. */
+					ast_clear_flag(&locflags, SIP_NEEDDESTROY);
+					sip_scheddestroy(p, 32000);
+				}
 				if ( p->initid != -1 ) {
 					/* channel still up - reverse dec of inUse counter
 					   only if the channel is not auto-congested */
@@ -6495,7 +6502,7 @@
 			ASTOBJ_UNREF(peer,sip_destroy_peer);
 	}
 	if (peer) {
-		if (!ast_test_flag(peer, SIP_DYNAMIC)) {
+		if (!ast_test_flag(&peer->flags_page2, SIP_PAGE2_DYNAMIC)) {
 			ast_log(LOG_ERROR, "Peer '%s' is trying to register, but not configured as host=dynamic\n", peer->name);
 		} else {
 			ast_copy_flags(p, peer, SIP_NAT);
@@ -7170,6 +7177,7 @@
 			}
 			if (!ast_strlen_zero(user->cid_name) && !ast_strlen_zero(p->cid_num)) 
 				ast_copy_string(p->cid_name, user->cid_name, sizeof(p->cid_name));
+			ast_copy_string(p->peername, user->name, sizeof(p->peername));
 			ast_copy_string(p->username, user->name, sizeof(p->username));
 			ast_copy_string(p->peersecret, user->secret, sizeof(p->peersecret));
 			ast_copy_string(p->subscribecontext, user->subscribecontext, sizeof(p->subscribecontext));
@@ -7313,8 +7321,8 @@
 			} else if (global_allowguest == 2) {
 				ast_copy_flags(p, &global_flags, SIP_OSPAUTH);
 				res = check_auth(p, req, p->randdata, sizeof(p->randdata), "", "", "", sipmethod, uri, reliable, ignore); 
+#endif
 			}
-#endif
 		}
 
 	}
@@ -7644,7 +7652,7 @@
 		
 		snprintf(srch, sizeof(srch), FORMAT, name,
 			iterator->addr.sin_addr.s_addr ? ast_inet_ntoa(iabuf, sizeof(iabuf), iterator->addr.sin_addr) : "(Unspecified)",
-			ast_test_flag(iterator, SIP_DYNAMIC) ? " D " : "   ", 	/* Dynamic or not? */
+			ast_test_flag(&iterator->flags_page2, SIP_PAGE2_DYNAMIC) ? " D " : "   ", 	/* Dynamic or not? */
 			(ast_test_flag(iterator, SIP_NAT) & SIP_NAT_ROUTE) ? " N " : "   ",	/* NAT=yes? */
 			iterator->ha ? " A " : "   ", 	/* permit/deny */
 			ntohs(iterator->addr.sin_port), status);
@@ -7652,7 +7660,7 @@
 		if (!s)  {/* Normal CLI list */
 			ast_cli(fd, FORMAT, name, 
 			iterator->addr.sin_addr.s_addr ? ast_inet_ntoa(iabuf, sizeof(iabuf), iterator->addr.sin_addr) : "(Unspecified)",
-			ast_test_flag(iterator, SIP_DYNAMIC) ? " D " : "   ",  /* Dynamic or not? */
+			ast_test_flag(&iterator->flags_page2, SIP_PAGE2_DYNAMIC) ? " D " : "   ",  /* Dynamic or not? */
 			(ast_test_flag(iterator, SIP_NAT) & SIP_NAT_ROUTE) ? " N " : "   ",	/* NAT=yes? */
 			iterator->ha ? " A " : "   ",       /* permit/deny */
 			
@@ -7674,7 +7682,7 @@
 			iterator->name, 
 			iterator->addr.sin_addr.s_addr ? ast_inet_ntoa(iabuf, sizeof(iabuf), iterator->addr.sin_addr) : "-none-",
 			ntohs(iterator->addr.sin_port), 
-			ast_test_flag(iterator, SIP_DYNAMIC) ? "yes" : "no",  /* Dynamic or not? */
+			ast_test_flag(&iterator->flags_page2, SIP_PAGE2_DYNAMIC) ? "yes" : "no",  /* Dynamic or not? */
 			(ast_test_flag(iterator, SIP_NAT) & SIP_NAT_ROUTE) ? "yes" : "no",	/* NAT=yes? */
 			iterator->ha ? "yes" : "no",       /* permit/deny */
 			status);
@@ -8047,7 +8055,7 @@
 		ast_cli(fd, "  VM Extension : %s\n", peer->vmexten);
 		ast_cli(fd, "  LastMsgsSent : %d\n", peer->lastmsgssent);
 		ast_cli(fd, "  Call limit   : %d\n", peer->call_limit);
-		ast_cli(fd, "  Dynamic      : %s\n", (ast_test_flag(peer, SIP_DYNAMIC)?"Yes":"No"));
+		ast_cli(fd, "  Dynamic      : %s\n", (ast_test_flag(&peer->flags_page2, SIP_PAGE2_DYNAMIC)?"Yes":"No"));
 		ast_cli(fd, "  Callerid     : %s\n", ast_callerid_merge(cbuf, sizeof(cbuf), peer->cid_name, peer->cid_num, "<unspecified>"));
 		ast_cli(fd, "  Expire       : %d\n", peer->expire);
 		ast_cli(fd, "  Insecure     : %s\n", insecure2str(ast_test_flag(peer, SIP_INSECURE_PORT), ast_test_flag(peer, SIP_INSECURE_INVITE)));
@@ -8119,7 +8127,7 @@
 		ast_cli(fd, "VoiceMailbox: %s\r\n", peer->mailbox);
 		ast_cli(fd, "LastMsgsSent: %d\r\n", peer->lastmsgssent);
 		ast_cli(fd, "Call limit: %d\r\n", peer->call_limit);
-		ast_cli(fd, "Dynamic: %s\r\n", (ast_test_flag(peer, SIP_DYNAMIC)?"Y":"N"));
+		ast_cli(fd, "Dynamic: %s\r\n", (ast_test_flag(&peer->flags_page2, SIP_PAGE2_DYNAMIC)?"Y":"N"));
 		ast_cli(fd, "Callerid: %s\r\n", ast_callerid_merge(cbuf, sizeof(cbuf), peer->cid_name, peer->cid_num, ""));
 		ast_cli(fd, "RegExpire: %ld seconds\r\n", ast_sched_when(sched,peer->expire));
 		ast_cli(fd, "SIP-AuthInsecure: %s\r\n", insecure2str(ast_test_flag(peer, SIP_INSECURE_PORT), ast_test_flag(peer, SIP_INSECURE_INVITE)));
@@ -9383,7 +9391,7 @@
 	} else  if (!strcasecmp(colname, "expire")) {
 		snprintf(buf, len, "%d", peer->expire);
 	} else  if (!strcasecmp(colname, "dynamic")) {
-		ast_copy_string(buf, (ast_test_flag(peer, SIP_DYNAMIC) ? "yes" : "no"), len);
+		ast_copy_string(buf, (ast_test_flag(&peer->flags_page2, SIP_PAGE2_DYNAMIC) ? "yes" : "no"), len);
 	} else  if (!strcasecmp(colname, "callerid_name")) {
 		ast_copy_string(buf, peer->cid_name, len);
 	} else  if (!strcasecmp(colname, "callerid_num")) {
@@ -9543,11 +9551,18 @@
 /*! \brief  check_pendings: Check pending actions on SIP call ---*/
 static void check_pendings(struct sip_pvt *p)
 {
-	/* Go ahead and send bye at this point */
 	if (ast_test_flag(p, SIP_PENDINGBYE)) {
-		transmit_request_with_auth(p, SIP_BYE, 0, 1, 1);
-		ast_set_flag(p, SIP_NEEDDESTROY);	
-		ast_clear_flag(p, SIP_NEEDREINVITE);	
+		/* if we can't BYE, then this is really a pending CANCEL */
+		if (!ast_test_flag(p, SIP_CAN_BYE)) {
+			transmit_request_with_auth(p, SIP_CANCEL, p->ocseq, 1, 0);
+			/* Actually don't destroy us yet, wait for the 487 on our original 
+			   INVITE, but do set an autodestruct just in case we never get it. */
+			sip_scheddestroy(p, 32000);
+		} else {
+			transmit_request_with_auth(p, SIP_BYE, 0, 1, 1);
+			ast_set_flag(p, SIP_NEEDDESTROY);	
+			ast_clear_flag(p, SIP_NEEDREINVITE);	
+		}
 	} else if (ast_test_flag(p, SIP_NEEDREINVITE)) {
 		ast_log(LOG_DEBUG, "Sending pending reinvite on '%s'\n", p->callid);
 		/* Didn't get to reinvite yet, so do it now */
@@ -9577,6 +9592,10 @@
 	switch (resp) {
 	case 100:	/* Trying */
 		sip_cancel_destroy(p);
+		/* must call check_pendings before setting CAN_BYE, so that
+		   if PENDINGBYE is set it will know to send CANCEL instead */
+		check_pendings(p);
+		ast_set_flag(p, SIP_CAN_BYE);
 		break;
 	case 180:	/* 180 Ringing */
 		sip_cancel_destroy(p);
@@ -9592,6 +9611,10 @@
 				ast_queue_control(p->owner, AST_CONTROL_PROGRESS);
 			}
 		}
+		/* must call check_pendings before setting CAN_BYE, so that
+		   if PENDINGBYE is set it will know to send CANCEL instead */
+		check_pendings(p);
+		ast_set_flag(p, SIP_CAN_BYE);
 		break;
 	case 183:	/* Session progress */
 		sip_cancel_destroy(p);
@@ -9603,6 +9626,10 @@
 				ast_queue_control(p->owner, AST_CONTROL_PROGRESS);
 			}
 		}
+		/* must call check_pendings before setting CAN_BYE, so that
+		   if PENDINGBYE is set it will know to send CANCEL instead */
+		check_pendings(p);
+		ast_set_flag(p, SIP_CAN_BYE);
 		break;
 	case 200:	/* 200 OK on invite - someone's answering our call */
 		sip_cancel_destroy(p);
@@ -10431,6 +10458,9 @@
 	if (!p->lastinvite && !ignore && !p->owner) {
 		/* Handle authentication if this is our first invite */
 		res = check_user(p, req, SIP_INVITE, e, 1, sin, ignore);
+		/* if an authentication challenge was sent, we are done here */
+		if (res > 0)
+			return 0;
 		if (res < 0) {
 			if (res == -4) {
 				ast_log(LOG_NOTICE, "Sending fake auth rejection for user %s\n", get_header(req, "From"));
@@ -10838,6 +10868,9 @@
 		}
 		/* Handle authentication if this is our first subscribe */
 		res = check_user_full(p, req, SIP_SUBSCRIBE, e, 0, sin, ignore, mailbox, mailboxsize);
+		/* if an authentication challenge was sent, we are done here */
+		if (res > 0)
+			return 0;
 		if (res < 0) {
 			if (res == -4) {
 				ast_log(LOG_NOTICE, "Sending fake auth rejection for user %s\n", get_header(req, "From"));
@@ -12151,7 +12184,7 @@
 	peer->rtpholdtimeout = global_rtpholdtimeout;
 	peer->rtpkeepalive = global_rtpkeepalive;
 	ast_set_flag(peer, SIP_SELFDESTRUCT);
-	ast_set_flag(peer, SIP_DYNAMIC);
+	ast_set_flag(&peer->flags_page2, SIP_PAGE2_DYNAMIC);
 	peer->prefs = prefs;
 	reg_source_db(peer);
 
@@ -12282,7 +12315,7 @@
 					ast_log(LOG_WARNING, "You can't have a dynamic outbound proxy, you big silly head at line %d.\n", v->lineno);
 				} else {
 					/* They'll register with us */
-					ast_set_flag(peer, SIP_DYNAMIC);
+					ast_set_flag(&peer->flags_page2, SIP_PAGE2_DYNAMIC);
 					if (!found) {
 						/* Initialize stuff iff we're not found, otherwise
 						   we keep going with what we had */
@@ -12299,7 +12332,7 @@
 				if (peer->expire > -1)
 					ast_sched_del(sched, peer->expire);
 				peer->expire = -1;
-				ast_clear_flag(peer, SIP_DYNAMIC);	
+				ast_clear_flag(&peer->flags_page2, SIP_PAGE2_DYNAMIC);	
 				if (!obproxyfound || !strcasecmp(v->name, "outboundproxy")) {
 					if (ast_get_ip_or_srv(&peer->addr, v->value, "_sip._udp")) {
 						ASTOBJ_UNREF(peer, sip_destroy_peer);
@@ -12322,7 +12355,7 @@
 		} else if (!strcasecmp(v->name, "permit") || !strcasecmp(v->name, "deny")) {
 			peer->ha = ast_append_ha(v->name, v->value, peer->ha);
 		} else if (!strcasecmp(v->name, "port")) {
-			if (!realtime && ast_test_flag(peer, SIP_DYNAMIC))
+			if (!realtime && ast_test_flag(&peer->flags_page2, SIP_PAGE2_DYNAMIC))
 				peer->defaddr.sin_port = htons(atoi(v->value));
 			else
 				peer->addr.sin_port = htons(atoi(v->value));
@@ -12404,7 +12437,7 @@
 		 */
 		v=v->next;
 	}
-	if (!ast_test_flag((&global_flags_page2), SIP_PAGE2_IGNOREREGEXPIRE) && ast_test_flag(peer, SIP_DYNAMIC) && realtime) {
+	if (!ast_test_flag((&global_flags_page2), SIP_PAGE2_IGNOREREGEXPIRE) && ast_test_flag(&peer->flags_page2, SIP_PAGE2_DYNAMIC) && realtime) {
 		time_t nowtime;
 
 		time(&nowtime);
@@ -12416,7 +12449,7 @@
 		}
 	}
 	ast_copy_flags(peer, &peerflags, mask.flags);
-	if (!found && ast_test_flag(peer, SIP_DYNAMIC) && !ast_test_flag(peer, SIP_REALTIME))
+	if (!found && ast_test_flag(&peer->flags_page2, SIP_PAGE2_DYNAMIC) && !ast_test_flag(peer, SIP_REALTIME))
 		reg_source_db(peer);
 	ASTOBJ_UNMARK(peer);
 	ast_free_ha(oldha);

Modified: team/crichter/0.4.0/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/channels/chan_zap.c?rev=31439&r1=31438&r2=31439&view=diff
==============================================================================
--- team/crichter/0.4.0/channels/chan_zap.c (original)
+++ team/crichter/0.4.0/channels/chan_zap.c Thu Jun  1 12:12:03 2006
@@ -2125,9 +2125,8 @@
 				prilocaldialplan = PRI_LOCAL_ISDN;
 			}
 		}
-		pri_sr_set_caller(sr, l ? (l + ldp_strip) : NULL, n, prilocaldialplan, 
-					l ? (p->use_callingpres ? ast->cid.cid_pres : PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN) : 
-						 PRES_NUMBER_NOT_AVAILABLE);
+		pri_sr_set_caller(sr, l ? (l + ldp_strip) : NULL, n, prilocaldialplan,
+				  p->use_callingpres ? ast->cid.cid_pres : (l ? PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN : PRES_NUMBER_NOT_AVAILABLE));
 		pri_sr_set_redirecting(sr, ast->cid.cid_rdnis, p->pri->localdialplan - 1, PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN, PRI_REDIR_UNCONDITIONAL);
 
 #ifdef SUPPORT_USERUSER
@@ -6399,18 +6398,18 @@
 	case ZT_EVENT_NOALARM:
 		i->inalarm = 0;
 		ast_log(LOG_NOTICE, "Alarm cleared on channel %d\n", i->channel);
+		manager_event(EVENT_FLAG_SYSTEM, "AlarmClear",
+		              "Channel: %d\r\n", i->channel);
 		break;
-               manager_event(EVENT_FLAG_SYSTEM, "AlarmClear",
-                                                       "Channel: %d\r\n", i->channel);
 	case ZT_EVENT_ALARM:
 		i->inalarm = 1;

[... 499 lines stripped ...]


More information about the asterisk-commits mailing list