diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 23f936efbf..96793258d6 100755 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -3500,6 +3500,7 @@ static int socket_read(int *id, int fd, short events, void *cbdata) int dcallno = 0; struct ast_iax2_full_hdr *fh = (struct ast_iax2_full_hdr *)buf; struct ast_iax2_mini_hdr *mh = (struct ast_iax2_mini_hdr *)buf; + struct ast_iax2_meta_hdr *meta = (struct ast_iax2_meta_hdr *)buf; struct ast_iax2_frame fr, *cur; struct ast_frame f; struct ast_channel *c; @@ -3522,6 +3523,11 @@ static int socket_read(int *id, int fd, short events, void *cbdata) ast_log(LOG_WARNING, "midget packet received (%d of %d min)\n", res, sizeof(struct ast_iax2_mini_hdr)); return 1; } + if (meta->zeros == 0) { + /* This is a a meta header */ + ast_log(LOG_DEBUG, "Meta header Command = %d!\n", meta->metacmd); + return 1; + } #ifdef DEBUG_SUPPORT if (iaxdebug) showframe(NULL, fh, 1, &sin); diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index 0b7627d901..49d823b00c 100755 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -1345,6 +1345,7 @@ static int handle_request(struct mgcp_endpoint *p, struct mgcp_request *req, str p->alreadygone = 1; ast_queue_hangup(p->owner, 1); } + transmit_notify_request(p, "", 0); } else if ((strlen(ev) == 1) && (((ev[0] >= '0') && (ev[0] <= '9')) || ((ev[0] >= 'A') && (ev[0] <= 'D')) || diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 729bb816ee..385c483892 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -2249,6 +2249,7 @@ static int parse_contact(struct sip_pvt *pvt, struct sip_peer *p, struct sip_req port = atoi(pt); } else port = DEFAULT_SIP_PORT; + memcpy(&oldsin, &p->addr, sizeof(oldsin)); if (!p->nat) { /* XXX This could block for a long time XXX */ hp = gethostbyname(n); @@ -2256,7 +2257,6 @@ static int parse_contact(struct sip_pvt *pvt, struct sip_peer *p, struct sip_req ast_log(LOG_WARNING, "Invalid host '%s'\n", n); return -1; } - memcpy(&oldsin, &p->addr, sizeof(oldsin)); p->addr.sin_family = AF_INET; memcpy(&p->addr.sin_addr, hp->h_addr, sizeof(p->addr.sin_addr)); p->addr.sin_port = htons(port); @@ -2273,7 +2273,7 @@ static int parse_contact(struct sip_pvt *pvt, struct sip_peer *p, struct sip_req ast_sched_del(sched, p->expire); if ((expirey < 1) || (expirey > max_expirey)) expirey = max_expirey; - p->expire = ast_sched_add(sched, expirey * 1000, expire_register, p); + p->expire = ast_sched_add(sched, (expirey + 10) * 1000, expire_register, p); pvt->expirey = expirey; if (memcmp(&p->addr, &oldsin, sizeof(oldsin))) { sip_poke_peer(p); @@ -3629,7 +3629,7 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc static int sipsock_read(int *id, int fd, short events, void *ignore) { struct sip_request req; - struct sockaddr_in sin; + struct sockaddr_in sin = { 0, }; struct sip_pvt *p; int res; int len; diff --git a/channels/iax2.h b/channels/iax2.h index da8acadff8..b38609c413 100755 --- a/channels/iax2.h +++ b/channels/iax2.h @@ -96,6 +96,9 @@ #define IAX_AUTH_MD5 (1 << 1) #define IAX_AUTH_RSA (1 << 2) +#define IAX_META_TRUNK 1 /* Trunk meta-message */ +#define IAX_META_VIDEO 2 /* Video frame */ + #define IAX_DPSTATUS_EXISTS (1 << 0) #define IAX_DPSTATUS_CANEXIST (1 << 1) #define IAX_DPSTATUS_NONEXISTANT (1 << 2) @@ -116,11 +119,28 @@ struct ast_iax2_full_hdr { /* Mini header is used only for voice frames -- delivered unreliably */ struct ast_iax2_mini_hdr { - short callno; /* Source call number -- high bit must be 0 */ + unsigned short callno; /* Source call number -- high bit must be 0, rest must be non-zero */ unsigned short ts; /* 16-bit Timestamp (high 16 bits from last ast_iax2_full_hdr) */ /* Frametype implicitly VOICE_FRAME */ /* subclass implicit from last ast_iax2_full_hdr */ unsigned char iedata[0]; } __attribute__ ((__packed__)); +struct ast_iax2_meta_hdr { + unsigned short zeros; /* Zeros field -- must be zero */ + unsigned char metacmd; /* Meta command */ + unsigned char cmddata; /* Command Data */ + unsigned char data[0]; +} __attribute__ ((__packed__)); + +struct ast_iax2_meta_trunk_hdr { + unsigned int ts; /* 32-bit timestamp for all messages */ + unsigned char data[0]; +}; + +struct ast_iax2_meta_trunk_entry { + unsigned short callno; /* Call number */ + unsigned short len; /* Length of data for this callno */ +}; + #endif