• jssip无法识别以数字开始的域


    修改Grammar.js的parse_SIP_URI方法(大概在2886行)

          function parse_SIP_URI() {
            var result0, result1, result2, result3, result4, result5;
            var pos0, pos1;
            pos0 = pos;
            pos1 = pos;
            result0 = parse_uri_scheme();
            if (result0 !== null) {
              if (input.charCodeAt(pos) === 58) {
                result1 = ":";
                pos++;
              } else {
                result1 = null;
                if (reportFailures === 0) {
                  matchFailed("\":\"");
                }
              }
              if (result1 !== null) {
                result2 = parse_userinfo();
                result2 = result2 !== null ? result2 : "";
                if (result2 !== null) {
                  result3 = parse_hostport();
                  if (result3 !== null) {
                    result4 = parse_uri_parameters();
                    if (result4 !== null) {
                      result5 = parse_headers();
                      result5 = result5 !== null ? result5 : "";
                      if (result5 !== null) {
                        result0 = [result0, result1, result2, result3, result4, result5];
                      } else {
                        result0 = null;
                        pos = pos1;
                      }
                    } else {
                      result0 = null;
                      pos = pos1;
                    }
                  } else {
                    result0 = null;
                    pos = pos1;
                  }
                } else {
                  result0 = null;
                  pos = pos1;
                }
              } else {
                result0 = null;
                pos = pos1;
              }
            } else {
              result0 = null;
              pos = pos1;
            }
            if (result0 !== null) {
              result0 = (function(offset) {
                                var header;
                                try {
                                    data.uri = new URI(data.scheme, data.user, data.host, data.port, data.uri_params, data.uri_headers);
                                    delete data.scheme;
                                    delete data.user;
                                    delete data.host;
                                    delete data.host_type;
                                    delete data.port;
                                    delete data.uri_params;
                                    if (startRule === 'SIP_URI') { data = data.uri;}
                                  } catch(e) {
                                    data = -1;
                                  }})(pos0);
            }
            if (result0 === null) {
              pos = pos0;
            }
            // 以下代码为新加
            if(result0 === null){
              if(startRule === 'SIP_URI'){
                if(input.includes('@')){
                  var t = input.split(/:|@/g);
                  data = new URI(t[0], t[1], t[2]);
                  result0 = undefined;
                  pos = input.length;
                }
              }else if(startRule === 'From' || startRule === 'To'){
                  var t = input.split(/<|>/g);
                  data.tag = t[2].split('=')[1];
                  t = t[1].split(/:|@/g);
                  data.uri = new URI(t[0], t[1], t[2]);
                  delete data.scheme;
                  delete data.user;
                  delete data.host;
                  delete data.host_type;
                  delete data.port;
                  delete data.uri_params;
                  result0 = undefined;
                  pos = input.split('>')[0].length;
              } else if(startRule === 'Contact'){
                
              }
            }
            // 以上代码为新加
            return result0;
          }
    
  • 相关阅读:
    linux项目部署学习(1) pyhton3的虚拟环境virtualenv和virtualenvwrapper详解
    linux下pip查看安装包的路径、和指定安装目录
    python+selenium实现长截图
    selenium设置chrome浏览器保持登录方式两种options和cookie
    linux中离线安装django
    理解 bashrc 和 profile
    Django部署阿里云服务时候报错:SQLite 3.8.3 or later is required (found 3.7.17)
    Django的django-admin工具详解
    Yum Install --Downloadonly 离线下载依赖包研究
    分治法求n个点中的最近距离
  • 原文地址:https://www.cnblogs.com/zh33gl/p/15623632.html
Copyright © 2020-2023  润新知