Idefisk
Tools
Tutorials
Reviews
VoIP Providers
Archives
AsteriskGuru Archives
Mailing List Archives
FAQ
Search
Memberlist
Usergroups
Register
Profile
Log in to check your private messages
Log in
[Asterisk-Dev] MGCP dirty fixes
AsteriskGuru Archives Forum Index
->
Asterisk-Dev
View previous topic
::
View next topic
Author
Message
asterisk-dev at lists.dig
Guest
Posted: Fri Mar 28, 2003 12:51 pm
Post subject: [Asterisk-Dev] MGCP dirty fixes
In case someone finds them useful to get started with MGCP phones with *:
(Mark, please do not apply, the patches are wrong, and need to be redone
correctly).
Issues "covered up":
a) "hook flash"
b) "timeouts" for MGCP
c) absence of "hbz" tone on dlink
Index: channels/chan_mgcp.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_mgcp.c,v
retrieving revision 1.4
diff --unified -r1.4 chan_mgcp.c
--- channels/chan_mgcp.c 24 Mar 2003 22:20:28 -0000 1.4
+++ channels/chan_mgcp.c 28 Mar 2003 12:55:54 -0000
@@ -140,6 +140,7 @@
int iseq;
int nat;
int lastout;
+ time_t lastouttime;
int alreadygone;
int needdestroy;
int capability;
@@ -220,8 +221,14 @@
{
struct mgcp_message *msg = malloc(sizeof(struct mgcp_message) + len);
struct mgcp_message *cur;
+ time_t t;
if (!msg)
return -1;
+ time(&t);
+ if (p->messagepending && (p->lastouttime + 20 < t)) {
+ ast_log(LOG_NOTICE, "UNDEFERRING based on %d/%d\n", p->lastouttime,t);
+ dump_queue(p);
+ }
msg->seqno = seqno;
msg->next = NULL;
msg ->len = len;
@@ -236,6 +243,7 @@
if (!p->messagepending) {
p->messagepending = 1;
p->lastout = seqno;
+ p->lastouttime = t;
__mgcp_xmit(p, msg->buf, msg->len);
/* XXX Should schedule retransmission XXX */
} else
@@ -540,16 +548,20 @@
static int mgcp_indicate(struct ast_channel *ast, int ind)
{
struct mgcp_endpoint *p = ast->pvt->pvt;
+/* ast_log(LOG_DEBUG, "Indicating condition %d\n", ind); */
switch(ind) {
case AST_CONTROL_RINGING:
transmit_notify_request(p, "rt", 1);
break;
+ case AST_CONTROL_CONGESTION:
case AST_CONTROL_BUSY:
transmit_notify_request(p, "bz", 1);
break;
+ /*
case AST_CONTROL_CONGESTION:
transmit_notify_request(p, "nbz", 1);
break;
+ */
case -1:
transmit_notify_request(p, "", 1);
break;
@@ -1267,6 +1279,7 @@
static void handle_response(struct mgcp_endpoint *p, int result, int ident)
{
struct mgcp_message *cur;
+ time_t t;
if (p->msgs && (p->msgs->seqno == ident)) {
ast_log(LOG_DEBUG, "Got response back on tansaction %d\n", ident);
cur = p->msgs;
@@ -1276,6 +1289,8 @@
/* Send next pending message if appropriate */
p->messagepending = 1;
p->lastout = p->msgs->seqno;
+ time(&t);
+ p->lastouttime = t;
__mgcp_xmit(p, p->msgs->buf, p->msgs->len);
/* XXX Should schedule retransmission XXX */
} else
@@ -1381,6 +1396,16 @@
/* Keep looking for events unless this was a hangup */
if (strcasecmp(ev, "hu") && strcasecmp(ev, "hd"))
transmit_notify_request(p, p->curtone, 1);
+ if (!strcasecmp(ev, "hf")) {
+ ast_log(LOG_DEBUG, "Alex: HookeFlashe\n");
+ if (p->owner) {
+ p->alreadygone = 1;
+ ast_queue_hangup(p->owner, 1);
+ }
+ transmit_notify_request(p, "", 0);
+ ev="hd";
+ }
+
if (!strcasecmp(ev, "hd")) {
/* Off hook / answer */
if (p->outgoing) {
@@ -1405,6 +1430,7 @@
ast_log(LOG_WARNING, "Off hook, but alreaedy have owner on %s@%s\n", p->name, p->parent->name);
}
}
+/* alex */
} else if (!strcasecmp(ev, "hu")) {
ast_log(LOG_DEBUG, "Went on hook\n");
if (p->owner) {
Back to top
Display posts from previous:
All Posts
1 Day
7 Days
2 Weeks
1 Month
3 Months
6 Months
1 Year
Oldest First
Newest First
AsteriskGuru Archives Forum Index
->
Asterisk-Dev
All times are GMT
Page
1
of
1
Jump to:
Select a forum
Asterisk Mailing Lists
----------------
Asterisk-Users
Asterisk-Dev
Asterisk-CVS
Asterisk-Biz
Asterisk-Doc
Asterisk-BSD
Asterisk-Announce
Asterisk Call Centers
Asterisk-Video
Asterisk-Speech-Rec
Bristuff-Users
You
cannot
post new topics in this forum
You
cannot
reply to topics in this forum
You
cannot
edit your posts in this forum
You
cannot
delete your posts in this forum
You
cannot
vote in polls in this forum
Powered by
phpBB
© 2001, 2005 phpBB Group