--- asterisk-1.4.17/configs/sip.conf.sample 2007-11-27 08:34:19.000000000 +0100 +++ asterisk-1.4.17-h324m/configs/sip.conf.sample 2008-03-04 19:57:54.000000000 +0100 @@ -123,6 +123,12 @@ ;maxcallbitrate=384 ; Maximum bitrate for video calls (default 384 kb/s) ; Videosupport and maxcallbitrate is settable ; for peers and users as well +;maxcallbitrate_h263p=80 ; Maximum bitrate for h263p video calls. 0 means 'no maximum' + ; thus no header is added to SDP. (default 0 kb/s) + ; This is only a global setting. This option uses the obsolete + ; MaxBR parameter. Successful tested with eyebeam. + ; 80 kbit is fine for SIP<-->H324M calls + ; it also adds the standard conform b=TIAS:..... parameter ;callevents=no ; generate manager events when sip ua ; performs events (e.g. hold) ;alwaysauthreject = yes ; When an incoming INVITE or REGISTER is to be rejected, --- asterisk-1.4.17/channels/chan_sip.c 2008-01-02 21:24:09.000000000 +0100 +++ asterisk-1.4.17-h324m/channels/chan_sip.c 2008-01-18 12:01:26.000000000 +0100 @@ -510,6 +510,7 @@ #define DEFAULT_QUALIFY FALSE #define DEFAULT_T1MIN 100 /*!< 100 MS for minimal roundtrip time */ #define DEFAULT_MAX_CALL_BITRATE (384) /*!< Max bitrate for video */ +#define DEFAULT_MAX_CALL_BITRATE_H263P (0) /*!< Max bitrate for video for h263p codec */ #ifndef DEFAULT_USERAGENT #define DEFAULT_USERAGENT "Asterisk PBX" /*!< Default Useragent: header unless re-defined in sip.conf */ #endif @@ -528,7 +529,8 @@ static char default_mohinterpret[MAX_MUSICCLASS]; /*!< Global setting for moh class to use when put on hold */ static char default_mohsuggest[MAX_MUSICCLASS]; /*!< Global setting for moh class to suggest when putting * a bridged channel on hold */ -static int default_maxcallbitrate; /*!< Maximum bitrate for call */ +static int default_maxcallbitrate; /*!< Maximum bitrate for call */ +static int default_maxcallbitrate_h263p; /*!< Maximum bitrate for call for h263p codec */ static struct ast_codec_pref default_prefs; /*!< Default codec prefs */ /* Global settings only apply to the channel */ @@ -960,6 +962,7 @@ int jointnoncodeccapability; /*!< Joint Non codec capability */ int redircodecs; /*!< Redirect codecs */ int maxcallbitrate; /*!< Maximum Call Bitrate for Video Calls */ + int maxcallbitrate_h263p; /*!< Maximum Call Bitrate for Video Calls with h263p codec*/ struct t38properties t38; /*!< T38 settings */ struct sockaddr_in udptlredirip; /*!< Where our T.38 UDPTL should be going if not to us */ struct ast_udptl *udptl; /*!< T.38 UDPTL session */ @@ -4463,6 +4466,7 @@ if (p->udptl) ast_udptl_settos(p->udptl, global_tos_audio); p->maxcallbitrate = default_maxcallbitrate; + p->maxcallbitrate_h263p = default_maxcallbitrate_h263p; } if (useglobal_nat && sin) { @@ -6180,6 +6184,10 @@ } else if (codec == AST_FORMAT_ILBC) { /* Add information about us using only 20/30 ms packetization */ ast_build_string(a_buf, a_size, "a=fmtp:%d mode=%d\r\n", rtp_code, fmt.cur_ms); + } else if (codec == AST_FORMAT_H263_PLUS) { + /* Add eyebeam style maxbandwidth description */ + if (p->maxcallbitrate_h263p) + ast_build_string(a_buf, a_size, "a=fmtp:%d QCIF=1 MaxBR=%d0\r\n", rtp_code,p->maxcallbitrate_h263p); } if (fmt.cur_ms && (fmt.cur_ms < *min_packet_size)) @@ -6367,12 +6375,15 @@ char *hold; char m_audio[256]; /* Media declaration line for audio */ char m_video[256]; /* Media declaration line for video */ + char b_video[1024]; /* Bandwidth for video */ char a_audio[1024]; /* Attributes for audio */ char a_video[1024]; /* Attributes for video */ char *m_audio_next = m_audio; char *m_video_next = m_video; size_t m_audio_left = sizeof(m_audio); size_t m_video_left = sizeof(m_video); + char *b_video_next = b_video; + size_t b_video_left = sizeof(b_video); char *a_audio_next = a_audio; char *a_video_next = a_video; size_t a_audio_left = sizeof(a_audio); @@ -6538,6 +6549,10 @@ debug, &min_video_packet_size); } + /* Build b= bandwidth SDP lines for video */ + if ((needvideo) && (p->maxcallbitrate_h263p)) + ast_build_string(&b_video_next, &b_video_left, "b=TIAS:%d\r\n", (p->maxcallbitrate_h263p)*1000); + /* Now add DTMF RFC2833 telephony-event as a codec */ for (x = 1; x <= AST_RTP_MAX; x <<= 1) { if (!(p->jointnoncodeccapability & x)) @@ -6570,7 +6585,7 @@ len = strlen(version) + strlen(subject) + strlen(owner) + strlen(connection) + strlen(stime) + strlen(m_audio) + strlen(a_audio) + strlen(hold); if (needvideo) /* only if video response is appropriate */ - len += strlen(m_video) + strlen(a_video) + strlen(bandwidth) + strlen(hold); + len += strlen(m_video) + strlen(b_video) + strlen(a_video) + strlen(bandwidth) + strlen(hold); add_header(resp, "Content-Type", "application/sdp"); add_header_contentLength(resp, len); @@ -6586,6 +6601,7 @@ add_line(resp, hold); if (needvideo) { /* only if video response is appropriate */ add_line(resp, m_video); + add_line(resp, b_video); add_line(resp, a_video); add_line(resp, hold); /* Repeat hold for the video stream */ } @@ -10634,6 +10650,7 @@ ast_cli(fd, " Notify hold state: %s\n", global_notifyhold ? "Yes" : "No"); ast_cli(fd, " SIP Transfer mode: %s\n", transfermode2str(global_allowtransfer)); ast_cli(fd, " Max Call Bitrate: %d kbps\r\n", default_maxcallbitrate); + ast_cli(fd, " Max Call Bitrate h263p: %d kbps\r\n", default_maxcallbitrate_h263p); ast_cli(fd, " Auto-Framing: %s \r\n", global_autoframing ? "Yes" : "No"); ast_cli(fd, "\nDefault Settings:\n"); ast_cli(fd, "-----------------\n"); @@ -16799,6 +16816,7 @@ default_fromdomain[0] = '\0'; default_qualify = DEFAULT_QUALIFY; default_maxcallbitrate = DEFAULT_MAX_CALL_BITRATE; + default_maxcallbitrate_h263p = DEFAULT_MAX_CALL_BITRATE_H263P; ast_copy_string(default_mohinterpret, DEFAULT_MOHINTERPRET, sizeof(default_mohinterpret)); ast_copy_string(default_mohsuggest, DEFAULT_MOHSUGGEST, sizeof(default_mohsuggest)); ast_copy_string(default_vmexten, DEFAULT_VMEXTEN, sizeof(default_vmexten)); @@ -17059,6 +17077,10 @@ default_maxcallbitrate = atoi(v->value); if (default_maxcallbitrate < 0) default_maxcallbitrate = DEFAULT_MAX_CALL_BITRATE; + } else if (!strcasecmp(v->name, "maxcallbitrate_h263p")) { + default_maxcallbitrate_h263p = atoi(v->value); + if (default_maxcallbitrate_h263p < 0) + default_maxcallbitrate_h263p = DEFAULT_MAX_CALL_BITRATE_H263P; } else if (!strcasecmp(v->name, "matchexterniplocally")) { global_matchexterniplocally = ast_true(v->value); }