diff options
author | matteo <matteo@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-02-20 06:00:14 +0000 |
---|---|---|
committer | matteo <matteo@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-02-20 06:00:14 +0000 |
commit | 4e8c9944cb2345492550457f79ea79905dadca79 (patch) | |
tree | 52c2c6abd07e82e95cb7b09c31804c0e9bd1f5f6 | |
parent | 28be2d6a7cb7f8915b0f346a9a2c02dd2fc5bf1f (diff) |
Thu Feb 20 07:00:00 CET 2003
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@619 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-x | asterisk.c | 1 | ||||
-rwxr-xr-x | channels/chan_sip.c | 21 | ||||
-rwxr-xr-x | rtp.c | 5 |
3 files changed, 24 insertions, 3 deletions
diff --git a/asterisk.c b/asterisk.c index e403c7f8c..5aedc3495 100755 --- a/asterisk.c +++ b/asterisk.c @@ -395,6 +395,7 @@ static void quit_handler(int num, int nice, int safeshutdown, int restart) ast_verbose("Asterisk %s ending (%d).\n", ast_active_channels() ? "uncleanly" : "cleanly", num); else if (option_debug) ast_log(LOG_DEBUG, "Asterisk ending (%d).\n", num); + manager_event(EVENT_FLAG_SYSTEM, "Shutdown", "Shutdown: %s\r\nRestart: %s\r\n", ast_active_channels() ? "Uncleanly" : "Cleanly", restart ? "True" : "False"); if (ast_socket > -1) { close(ast_socket); ast_socket = -1; diff --git a/channels/chan_sip.c b/channels/chan_sip.c index f579f7366..557e83b6a 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -1632,8 +1632,10 @@ static int add_sdp(struct sip_request *resp, struct sip_pvt *p, struct ast_rtp * { int len; int codec; + int alreadysent = 0; char costr[80]; struct sockaddr_in sin; + struct sip_codec_pref *cur; char v[256]; char s[256]; char o[256]; @@ -1665,8 +1667,25 @@ static int add_sdp(struct sip_request *resp, struct sip_pvt *p, struct ast_rtp * snprintf(c, sizeof(c), "c=IN IP4 %s\r\n", inet_ntoa(dest.sin_addr)); snprintf(t, sizeof(t), "t=0 0\r\n"); snprintf(m, sizeof(m), "m=audio %d RTP/AVP", ntohs(dest.sin_port)); + /* Start by sending our preferred codecs */ + cur = prefs; + while(cur) { + if (p->capability & cur->codec) { + if (sipdebug) + ast_verbose("Answering with preferred capability %d\n", cur->codec); + if ((codec = ast2rtp(cur->codec)) > -1) { + snprintf(costr, sizeof(costr), " %d", codec); + strcat(m, costr); + snprintf(costr, sizeof(costr), "a=rtpmap:%d %s/8000\r\n", codec, ast2rtpn(x)); + strcat(a, costr); + } + } + alreadysent |= cur->codec; + cur = cur->next; + } + /* Now send anything else in no particular order */ for (x=1;x<= AST_FORMAT_MAX_AUDIO; x <<= 1) { - if (p->capability & x) { + if ((p->capability & x) && !(alreadysent & x)) { if (sipdebug) ast_verbose("Answering with capability %d\n", x); if ((codec = ast2rtp(x)) > -1) { @@ -592,11 +592,12 @@ static int ast_rtp_raw_write(struct ast_rtp *rtp, struct ast_frame *f, int codec /* Re-calculate last TS */ rtp->lastts = ms * 8; - +#if 0 /* XXX Experiment -- Make timestamp always relative XXX */ /* If it's close to ou prediction, go for it */ if (abs(rtp->lastts - pred) < 640) +#endif rtp->lastts = pred; -#if 1 +#if 0 else printf("Difference is %d, ms is %d\n", abs(rtp->lastts - pred), ms); #endif |