--- asterisk8932/channels/chan_sip.c 2006-01-31 17:06:43.000000000 +0000 +++ asterisk/channels/chan_sip.c 2006-01-31 17:17:43.000000000 +0000 @@ -140,6 +140,9 @@ #define CALLERID_UNKNOWN "Unknown" +#define DEFAULT_MAX_CALL_BITRATE (384) +static int global_maxcallbitrate = DEFAULT_MAX_CALL_BITRATE; + #define DEFAULT_MAXMS 2000 /*!< Qualification: Must be faster than 2 seconds by default */ #define DEFAULT_FREQ_OK 60 * 1000 /*!< Qualification: How often to check for the host to be up */ #define DEFAULT_FREQ_NOTOK 10 * 1000 /*!< Qualification: How often to check, if the host is down... */ @@ -353,7 +356,6 @@ #define DEFAULT_NOTIFYMIME "application/simple-message-summary" #define DEFAULT_MWITIME 10 #define DEFAULT_ALLOWGUEST TRUE -#define DEFAULT_VIDEOSUPPORT FALSE #define DEFAULT_SRVLOOKUP FALSE /*!< Recommended setting is ON */ #define DEFAULT_COMPACTHEADERS FALSE #define DEFAULT_TOS FALSE @@ -379,7 +381,6 @@ static int default_qualify; /*!< Default Qualify= setting */ static char default_vmexten[AST_MAX_EXTENSION]; static char default_musicclass[MAX_MUSICCLASS]; /*!< Global music on hold class */ -static struct ast_codec_pref default_prefs; /*!< Default codec prefs */ /* Global settings only apply to the channel */ static int global_rtautoclear = 120; @@ -396,7 +397,6 @@ static int global_allowguest; /*!< allow unauthenticated users/peers to connect? */ static int global_mwitime; /*!< Time between MWI checks for peers */ static int global_tos; /*!< IP Type of service */ -static int global_videosupport; /*!< Videosupport on or off */ static int compactheaders; /*!< send compact sip headers */ static int recordhistory; /*!< Record SIP history. Off by default */ static int dumphistory; /*!< Dump history to verbose before destroying SIP dialog */ @@ -444,12 +444,13 @@ static int sip_reloading = FALSE; /*!< Flag for avoiding multiple reloads at the same time */ static enum channelreloadreason sip_reloadreason; /*!< Reason for last reload/load of configuration */ -static struct sched_context *sched; /*!< The scheduling context */ -static struct io_context *io; /*!< The IO context */ +static struct sched_context *sched; +static struct io_context *io; #define DEC_CALL_LIMIT 0 #define INC_CALL_LIMIT 1 +static struct ast_codec_pref prefs; /*! \brief sip_request: The data grabbed from the UDP socket */ struct sip_request { @@ -593,6 +594,10 @@ #define SIP_PAGE2_DEBUG (3 << 5) #define SIP_PAGE2_DEBUG_CONFIG (1 << 5) #define SIP_PAGE2_DEBUG_CONSOLE (1 << 6) +#define SIP_PAGE2_VIDEOSUPPORT (1 << 7) + +#define SIP_PAGE2_FLAGS_TO_COPY \ + (SIP_PAGE2_VIDEOSUPPORT) /* SIP packet flags */ #define SIP_PKT_DEBUG (1 << 0) /*!< Debug this packet */ @@ -654,6 +659,7 @@ ast_group_t pickupgroup; /*!< Pickup group */ int lastinvite; /*!< Last Cseq of invite */ unsigned int flags; /*!< SIP_ flags */ + struct ast_flags flags_page2; /*!< SIP_PAGE2 flags */ int timer_t1; /*!< SIP timer T1, ms rtt */ unsigned int sipoptions; /*!< Supported SIP sipoptions on the other end */ int capability; /*!< Special capability (codec) */ @@ -661,6 +667,7 @@ int peercapability; /*!< Supported peer capability */ int prefcodec; /*!< Preferred codec (outbound only) */ int noncodeccapability; + int maxcallbitrate; /*!< Maximum Call Bitrate for Video Calls */ int callingpres; /*!< Calling presentation */ int authtries; /*!< Times we've tried to authenticate */ int expiry; /*!< How long we take to expire */ @@ -761,6 +768,7 @@ int call_limit; /*!< Limit of concurrent calls */ struct ast_ha *ha; /*!< ACL setting */ struct ast_variable *chanvars; /*!< Variables to set for channel created by user */ + int maxcallbitrate; /*!< Maximum Bitrate for a video call */ }; /*! \brief Structure for SIP peer data, we place calls to peers if registered or fixed IP address (host) */ @@ -805,7 +813,8 @@ ast_group_t pickupgroup; /*!< Pickup group */ struct ast_dnsmgr_entry *dnsmgr;/*!< DNS refresh manager for peer */ struct sockaddr_in addr; /*!< IP address of peer */ - + int maxcallbitrate; /*!< Maximum Bitrate for a video call */ + /* Qualification */ struct sip_pvt *call; /*!< Call pointer */ int pokeexpire; /*!< When to expire poke (qualify= checking) */ @@ -1896,7 +1905,12 @@ } ast_copy_flags(r, peer, SIP_FLAGS_TO_COPY); + ast_copy_flags((&r->flags_page2),(&peer->flags_page2), SIP_PAGE2_FLAGS_TO_COPY); r->capability = peer->capability; + if (!ast_test_flag((&r->flags_page2), SIP_PAGE2_VIDEOSUPPORT) && r->vrtp) { + ast_rtp_destroy(r->vrtp); + r->vrtp = NULL; + } r->prefs = peer->prefs; if (r->rtp) { ast_log(LOG_DEBUG, "Setting NAT on RTP to %d\n", (ast_test_flag(r, SIP_NAT) & SIP_NAT_ROUTE)); @@ -1953,7 +1967,8 @@ r->rtpkeepalive = peer->rtpkeepalive; if (peer->call_limit) ast_set_flag(r, SIP_CALL_LIMIT); - + r->maxcallbitrate = peer->maxcallbitrate; + return 0; } @@ -2803,6 +2818,7 @@ case AST_CONTROL_VIDUPDATE: /* Request a video frame update */ if (p->vrtp && !ast_test_flag(p, SIP_NOVIDEO)) { transmit_info_with_vidupdate(p); + /* ast_rtcp_send_h261fur(p->vrtp); */ res = 0; } else res = -1; @@ -3167,8 +3183,7 @@ p->autokillid = -1; p->subscribed = NONE; p->stateid = -1; - p->prefs = default_prefs; /* Set default codecs for this call */ - + p->prefs = prefs; if (intended_method != SIP_OPTIONS) /* Peerpoke has it's own system */ p->timer_t1 = 500; /* Default SIP retransmission timer T1 (RFC 3261) */ #ifdef OSP_SUPPORT @@ -3182,6 +3197,9 @@ } else { memcpy(&p->ourip, &__ourip, sizeof(p->ourip)); } + + ast_copy_flags(p, &global_flags, SIP_FLAGS_TO_COPY); + ast_copy_flags((&p->flags_page2),(&global_flags_page2), SIP_PAGE2_FLAGS_TO_COPY); p->branch = thread_safe_rand(); make_our_tag(p->tag, sizeof(p->tag)); @@ -3190,10 +3208,10 @@ if (sip_methods[intended_method].need_rtp) { p->rtp = ast_rtp_new_with_bindaddr(sched, io, 1, 0, bindaddr.sin_addr); - if (global_videosupport) + if (ast_test_flag((&p->flags_page2), SIP_PAGE2_VIDEOSUPPORT)) p->vrtp = ast_rtp_new_with_bindaddr(sched, io, 1, 0, bindaddr.sin_addr); - if (!p->rtp || (global_videosupport && !p->vrtp)) { - ast_log(LOG_WARNING, "Unable to create RTP audio %s session: %s\n", global_videosupport ? "and video" : "", strerror(errno)); + if (!p->rtp || (ast_test_flag((&p->flags_page2), SIP_PAGE2_VIDEOSUPPORT) && !p->vrtp)) { + ast_log(LOG_WARNING, "Unable to create RTP audio %s session: %s\n", ast_test_flag((&p->flags_page2), SIP_PAGE2_VIDEOSUPPORT) ? "and video" : "", strerror(errno)); ast_mutex_destroy(&p->lock); if (p->chanvars) { ast_variables_destroy(p->chanvars); @@ -3208,6 +3226,7 @@ p->rtptimeout = global_rtptimeout; p->rtpholdtimeout = global_rtpholdtimeout; p->rtpkeepalive = global_rtpkeepalive; + p->maxcallbitrate = global_maxcallbitrate; } if (useglobal_nat && sin) { @@ -3227,7 +3246,6 @@ build_callid_pvt(p); else ast_string_field_set(p, callid, callid); - ast_copy_flags(p, &global_flags, SIP_FLAGS_TO_COPY); /* Assign default music on hold class */ ast_string_field_set(p, musicclass, default_musicclass); p->capability = global_capability; @@ -4452,6 +4470,7 @@ char o[256]; char c[256]; char t[256]; + char b[256]; char m_audio[256]; char m_video[256]; char a_audio[1024]; @@ -4522,6 +4541,8 @@ snprintf(o, sizeof(o), "o=root %d %d IN IP4 %s\r\n", p->sessionid, p->sessionversion, ast_inet_ntoa(iabuf, sizeof(iabuf), dest.sin_addr)); snprintf(s, sizeof(s), "s=session\r\n"); snprintf(c, sizeof(c), "c=IN IP4 %s\r\n", ast_inet_ntoa(iabuf, sizeof(iabuf), dest.sin_addr)); + if ((p->vrtp) && (!ast_test_flag(p, SIP_NOVIDEO)) && (capability & VIDEO_CODEC_MASK)) /* only if video response is appropriate */ + snprintf(b, sizeof(b), "b=CT:%d\r\n", p->maxcallbitrate); snprintf(t, sizeof(t), "t=0 0\r\n"); ast_build_string(&m_audio_next, &m_audio_left, "m=audio %d RTP/AVP", ntohs(dest.sin_port)); @@ -4567,7 +4588,7 @@ } /* Now send any other common codecs, and non-codec formats: */ - for (x = 1; x <= ((global_videosupport && p->vrtp) ? AST_FORMAT_MAX_VIDEO : AST_FORMAT_MAX_AUDIO); x <<= 1) { + for (x = 1; x <= ((ast_test_flag((&p->flags_page2), SIP_PAGE2_VIDEOSUPPORT) && p->vrtp) ? AST_FORMAT_MAX_VIDEO : AST_FORMAT_MAX_AUDIO); x <<= 1) { if (!(capability & x)) continue; @@ -4606,7 +4627,7 @@ len = strlen(v) + strlen(s) + strlen(o) + strlen(c) + strlen(t) + strlen(m_audio) + strlen(a_audio); if ((p->vrtp) && (!ast_test_flag(p, SIP_NOVIDEO)) && (capability & VIDEO_CODEC_MASK)) /* only if video response is appropriate */ - len += strlen(m_video) + strlen(a_video); + len += strlen(m_video) + strlen(a_video) + strlen(b); add_header(resp, "Content-Type", "application/sdp"); add_header_contentLength(resp, len); @@ -4614,6 +4635,8 @@ add_line(resp, o); add_line(resp, s); add_line(resp, c); + if ((p->vrtp) && (!ast_test_flag(p, SIP_NOVIDEO)) && (capability & VIDEO_CODEC_MASK)) /* only if video response is appropriate */ + add_line(resp, b); add_line(resp, t); add_line(resp, m_audio); add_line(resp, a_audio); @@ -7149,6 +7172,7 @@ if (!(res = check_auth(p, req, user->name, user->secret, user->md5secret, sipmethod, uri, reliable, ignore))) { sip_cancel_destroy(p); ast_copy_flags(p, user, SIP_FLAGS_TO_COPY); + ast_copy_flags((&p->flags_page2),(&user->flags_page2), SIP_PAGE2_FLAGS_TO_COPY); /* Copy SIP extensions profile from INVITE */ if (p->sipoptions) user->sipoptions = p->sipoptions; @@ -7182,6 +7206,11 @@ p->callingpres = user->callingpres; p->capability = user->capability; p->jointcapability = user->capability; + p->maxcallbitrate = user->maxcallbitrate; + if (!ast_test_flag((&p->flags_page2), SIP_PAGE2_VIDEOSUPPORT) && p->vrtp) { + ast_rtp_destroy(p->vrtp); + p->vrtp = NULL; + } if (p->peercapability) p->jointcapability &= p->peercapability; if ((ast_test_flag(p, SIP_DTMF) == SIP_DTMF_RFC2833) || (ast_test_flag(p, SIP_DTMF) == SIP_DTMF_AUTO)) @@ -7301,6 +7330,11 @@ p->jointcapability = peer->capability; if (p->peercapability) p->jointcapability &= p->peercapability; + p->maxcallbitrate = peer->maxcallbitrate; + if (!ast_test_flag((&p->flags_page2), SIP_PAGE2_VIDEOSUPPORT) && p->vrtp) { + ast_rtp_destroy(p->vrtp); + p->vrtp = NULL; + } if ((ast_test_flag(p, SIP_DTMF) == SIP_DTMF_RFC2833) || (ast_test_flag(p, SIP_DTMF) == SIP_DTMF_AUTO)) p->noncodeccapability |= AST_RTP_DTMF; else @@ -7674,6 +7708,7 @@ "IPport: %d\r\n" "Dynamic: %s\r\n" "Natsupport: %s\r\n" + "Video Support: %s\r\n" "ACL: %s\r\n" "Status: %s\r\n\r\n", idtext, @@ -7682,6 +7717,7 @@ ntohs(iterator->addr.sin_port), ast_test_flag(iterator, SIP_DYNAMIC) ? "yes" : "no", /* Dynamic or not? */ (ast_test_flag(iterator, SIP_NAT) & SIP_NAT_ROUTE) ? "yes" : "no", /* NAT=yes? */ + ast_test_flag((&iterator->flags_page2), SIP_PAGE2_VIDEOSUPPORT) ? "yes" : "no", /* VIDEOSUPPORT=yes? */ iterator->ha ? "yes" : "no", /* permit/deny */ status); } @@ -8055,6 +8091,7 @@ 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, " Callerid : %s\n", ast_callerid_merge(cbuf, sizeof(cbuf), peer->cid_name, peer->cid_num, "")); + ast_cli(fd, " MaxCallBR : %dkbps\n", peer->maxcallbitrate); 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))); ast_cli(fd, " Nat : %s\n", nat2str(ast_test_flag(peer, SIP_NAT))); @@ -8062,6 +8099,7 @@ ast_cli(fd, " CanReinvite : %s\n", (ast_test_flag(peer, SIP_CAN_REINVITE)?"Yes":"No")); ast_cli(fd, " PromiscRedir : %s\n", (ast_test_flag(peer, SIP_PROMISCREDIR)?"Yes":"No")); ast_cli(fd, " User=Phone : %s\n", (ast_test_flag(peer, SIP_USEREQPHONE)?"Yes":"No")); + ast_cli(fd, " Video Support: %s\n", (ast_test_flag((&peer->flags_page2), SIP_PAGE2_VIDEOSUPPORT)?"Yes":"No")); ast_cli(fd, " Trust RPID : %s\n", (ast_test_flag(peer, SIP_TRUSTRPID) ? "Yes" : "No")); ast_cli(fd, " Send RPID : %s\n", (ast_test_flag(peer, SIP_SENDRPID) ? "Yes" : "No")); @@ -8129,6 +8167,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, "MaxCallBR: %dkbps\r\n", peer->maxcallbitrate); ast_cli(fd, "Dynamic: %s\r\n", (ast_test_flag(peer, SIP_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)); @@ -8138,6 +8177,7 @@ ast_cli(fd, "SIP-CanReinvite: %s\r\n", (ast_test_flag(peer, SIP_CAN_REINVITE)?"Y":"N")); ast_cli(fd, "SIP-PromiscRedir: %s\r\n", (ast_test_flag(peer, SIP_PROMISCREDIR)?"Y":"N")); ast_cli(fd, "SIP-UserPhone: %s\r\n", (ast_test_flag(peer, SIP_USEREQPHONE)?"Y":"N")); + ast_cli(fd, "SIP-VideoSupport: %s\r\n", (ast_test_flag((&peer->flags_page2), SIP_PAGE2_VIDEOSUPPORT)?"Y":"N")); /* - is enumerated */ ast_cli(fd, "SIP-DTMFmode %s\r\n", dtmfmode2str(ast_test_flag(peer, SIP_DTMF))); @@ -8284,7 +8324,7 @@ ast_cli(fd, "----------------\n"); ast_cli(fd, " SIP Port: %d\n", ntohs(bindaddr.sin_port)); ast_cli(fd, " Bindaddress: %s\n", ast_inet_ntoa(tmp, sizeof(tmp), bindaddr.sin_addr)); - ast_cli(fd, " Videosupport: %s\n", global_videosupport ? "Yes" : "No"); + ast_cli(fd, " Videosupport: %s\n", ast_test_flag((&global_flags_page2), SIP_PAGE2_VIDEOSUPPORT) ? "Yes" : "No"); ast_cli(fd, " AutoCreatePeer: %s\n", autocreatepeer ? "Yes" : "No"); ast_cli(fd, " Allow unknown access: %s\n", global_allowguest ? "Yes" : "No"); ast_cli(fd, " Promsic. redir: %s\n", ast_test_flag(&global_flags, SIP_PROMISCREDIR) ? "Yes" : "No"); @@ -8314,7 +8354,7 @@ ast_cli(fd, "\nGlobal Signalling Settings:\n"); ast_cli(fd, "---------------------------\n"); ast_cli(fd, " Codecs: "); - print_codec_to_cli(fd, &default_prefs); + print_codec_to_cli(fd, &prefs); ast_cli(fd, "\n"); ast_cli(fd, " T1 minimum: %d\n", global_t1min); ast_cli(fd, " Relax DTMF: %s\n", global_relaxdtmf ? "Yes" : "No"); @@ -8330,6 +8370,7 @@ ast_cli(fd, " Outbound reg. timeout: %d secs\n", global_reg_timeout); ast_cli(fd, " Outbound reg. attempts: %d\n", global_regattempts_max); ast_cli(fd, " Notify ringing state: %s\n", global_notifyringing ? "Yes" : "No"); + ast_cli(fd, " Max Call Bitrate: %dkbps\r\n", global_maxcallbitrate); ast_cli(fd, "\nDefault Settings:\n"); ast_cli(fd, "-----------------\n"); ast_cli(fd, " Context: %s\n", default_context); @@ -11975,8 +12016,10 @@ oldha = user->ha; user->ha = NULL; ast_copy_flags(user, &global_flags, SIP_FLAGS_TO_COPY); + ast_copy_flags((&user->flags_page2),(&global_flags_page2), SIP_PAGE2_FLAGS_TO_COPY); user->capability = global_capability; - user->prefs = default_prefs; + user->prefs = prefs; + user->maxcallbitrate = global_maxcallbitrate; /* set default context */ strcpy(user->context, default_context); strcpy(user->language, default_language); @@ -12037,7 +12080,18 @@ user->callingpres = ast_parse_caller_presentation(v->value); if (user->callingpres == -1) user->callingpres = atoi(v->value); - } + } else if (!strcasecmp(v->name, "maxcallbitrate")) { + user->maxcallbitrate = atoi(v->value); + if (user->maxcallbitrate < 0) + user->maxcallbitrate = global_maxcallbitrate; + } else if (!strcasecmp(v->name, "videosupport")) { + if (ast_test_flag((&global_flags_page2), SIP_PAGE2_VIDEOSUPPORT)) { + if (ast_true(v->value)) + ast_set_flag((&user->flags_page2), SIP_PAGE2_VIDEOSUPPORT); + else + ast_clear_flag((&user->flags_page2), SIP_PAGE2_VIDEOSUPPORT); + } + } } ast_copy_flags(user, &userflags, mask.flags); ast_free_ha(oldha); @@ -12066,12 +12120,13 @@ peer->addr.sin_port = htons(DEFAULT_SIP_PORT); peer->addr.sin_family = AF_INET; peer->capability = global_capability; + peer->maxcallbitrate = global_maxcallbitrate; peer->rtptimeout = global_rtptimeout; peer->rtpholdtimeout = global_rtpholdtimeout; peer->rtpkeepalive = global_rtpkeepalive; ast_set_flag(peer, SIP_SELFDESTRUCT); ast_set_flag(peer, SIP_DYNAMIC); - peer->prefs = default_prefs; + peer->prefs = prefs; reg_source_db(peer); return peer; @@ -12148,14 +12203,16 @@ peer->pickupgroup = 0; peer->rtpkeepalive = global_rtpkeepalive; peer->maxms = default_qualify; - peer->prefs = default_prefs; + peer->prefs = prefs; oldha = peer->ha; peer->ha = NULL; peer->addr.sin_family = AF_INET; ast_copy_flags(peer, &global_flags, SIP_FLAGS_TO_COPY); + ast_copy_flags((&peer->flags_page2),(&global_flags_page2), SIP_PAGE2_FLAGS_TO_COPY); peer->capability = global_capability; peer->rtptimeout = global_rtptimeout; peer->rtpholdtimeout = global_rtpholdtimeout; + peer->maxcallbitrate = global_maxcallbitrate; while(v) { if (handle_common_options(&peerflags, &mask, v)) { v = v->next; @@ -12188,7 +12245,14 @@ ast_copy_string(peer->fromdomain, v->value, sizeof(peer->fromdomain)); else if (!strcasecmp(v->name, "usereqphone")) ast_set2_flag(peer, ast_true(v->value), SIP_USEREQPHONE); - else if (!strcasecmp(v->name, "fromuser")) + else if (!strcasecmp(v->name, "videosupport")) { + if (ast_test_flag((&global_flags_page2), SIP_PAGE2_VIDEOSUPPORT)) { + if (ast_true(v->value)) + ast_set_flag((&peer->flags_page2), SIP_PAGE2_VIDEOSUPPORT); + else + ast_clear_flag((&peer->flags_page2), SIP_PAGE2_VIDEOSUPPORT); + } + } else if (!strcasecmp(v->name, "fromuser")) ast_copy_string(peer->fromuser, v->value, sizeof(peer->fromuser)); else if (!strcasecmp(v->name, "host") || !strcasecmp(v->name, "outboundproxy")) { if (!strcasecmp(v->value, "dynamic")) { @@ -12312,6 +12376,10 @@ ast_log(LOG_WARNING, "Qualification of peer '%s' should be 'yes', 'no', or a number of milliseconds at line %d of sip.conf\n", peer->name, v->lineno); peer->maxms = 0; } + } else if (!strcasecmp(v->name, "maxcallbitrate")) { + peer->maxcallbitrate = atoi(v->value); + if (peer->maxcallbitrate < 0) + peer->maxcallbitrate = global_maxcallbitrate; } /* else if (strcasecmp(v->name,"type")) * ast_log(LOG_WARNING, "Ignoring %s\n", v->name); @@ -12374,7 +12442,7 @@ memset(&bindaddr, 0, sizeof(bindaddr)); memset(&localaddr, 0, sizeof(localaddr)); memset(&externip, 0, sizeof(externip)); - memset(&default_prefs, 0 , sizeof(default_prefs)); + memset(&prefs, 0 , sizeof(prefs)); outboundproxyip.sin_port = htons(DEFAULT_SIP_PORT); outboundproxyip.sin_family = AF_INET; /* Type of address: IPv4 */ ourport = DEFAULT_SIP_PORT; @@ -12394,7 +12462,6 @@ ast_copy_string(default_notifymime, DEFAULT_NOTIFYMIME, sizeof(default_notifymime)); ast_copy_string(global_realm, DEFAULT_REALM, sizeof(global_realm)); ast_copy_string(default_callerid, DEFAULT_CALLERID, sizeof(default_callerid)); - global_videosupport = DEFAULT_VIDEOSUPPORT; compactheaders = DEFAULT_COMPACTHEADERS; global_reg_timeout = DEFAULT_REGISTRATION_TIMEOUT; global_regattempts_max = 0; @@ -12428,6 +12495,8 @@ global_relaxdtmf = FALSE; global_callevents = FALSE; global_t1min = DEFAULT_T1MIN; + global_maxcallbitrate = DEFAULT_MAX_CALL_BITRATE; + ast_clear_flag(&global_flags_page2, SIP_PAGE2_VIDEOSUPPORT); /* Read the [general] config section of sip.conf (or from realtime config) */ for (v = ast_variable_browse(cfg, "general"); v; v = v->next) { @@ -12484,7 +12553,7 @@ global_rtpkeepalive = 0; } } else if (!strcasecmp(v->name, "videosupport")) { - global_videosupport = ast_true(v->value); + ast_set2_flag((&global_flags_page2), ast_true(v->value), SIP_PAGE2_VIDEOSUPPORT); } else if (!strcasecmp(v->name, "compactheaders")) { compactheaders = ast_true(v->value); } else if (!strcasecmp(v->name, "notifymimetype")) { @@ -12575,9 +12644,9 @@ externrefresh = 10; } } else if (!strcasecmp(v->name, "allow")) { - ast_parse_allow_disallow(&default_prefs, &global_capability, v->value, 1); + ast_parse_allow_disallow(&prefs, &global_capability, v->value, 1); } else if (!strcasecmp(v->name, "disallow")) { - ast_parse_allow_disallow(&default_prefs, &global_capability, v->value, 0); + ast_parse_allow_disallow(&prefs, &global_capability, v->value, 0); } else if (!strcasecmp(v->name, "allowexternaldomains")) { allow_external_domains = ast_true(v->value); } else if (!strcasecmp(v->name, "autodomain")) { @@ -12618,6 +12687,11 @@ } } else if (!strcasecmp(v->name, "callevents")) { global_callevents = ast_true(v->value); + } else if (!strcasecmp(v->name, "maxcallbitrate")) { + global_maxcallbitrate = atoi(v->value); + if (global_maxcallbitrate < 0) + global_maxcallbitrate = DEFAULT_MAX_CALL_BITRATE; + ast_log(LOG_NOTICE,"Default Video Bitrate set to %dkbps\n", global_maxcallbitrate); } }