Pjsip note

  • pjsua的 启动参数可以这样设置 :

    前提是 服务器在 192.168.18.6 , 设置的来源是 pjsip手册:

    https://www.pjsip.org/pjsua.htm

    设置以后, 在手机上用zoiper 注册到 192.168.18.6 , 然后用pjsua 程序 先 m 命令, 再输入:

    就可以打电话到手机 , 192.168.18.5:36876 是注册以后, 在服务器看到的当前用户信息 。


     

  • pjsua 重要的结构

a) endpoint

注意每个 endpoint 维护着一个 module 数组

 

 

visual studio Common macros for build commands and properties

编译时经常能看到 这样的宏 :  $(SolutionDir)$(Configuration)\

在这个网址, 能看到所有宏的详细解释  https://docs.microsoft.com/en-us/cpp/ide/common-macros-for-build-commands-and-properties?view=vs-2017

 

但是, 如果能看到具体的路径, 当然更明确了, 那么, 怎么看到 ?  或者说,怎么把这些变量print 出来 ?

 

方法是: 项目 properties—–>Build Event—-> pre 或者 post build event 都可以 —-> command line —-> edit ——> macro 

就可以看到这些macro 的 name value pair

 

 

c Notes

  • 为什么 c 语言有static function

c++ class 有 static function 能理解, 代表不用实例化类也可以调用的函数

c 并没有类的概念, static function 是什么意思 ?

解释 : In C, functions are global by default. The “static” keyword before a function name makes it static.

Unlike global functions in C, access to static functions is restricted to the file where they are declared.

用代码说明 :

/* Inside file1.c */
static void fun1(void)
{
  puts("fun1 called");
}
/* Iinside file2.c  */
intmain(void)
{
  fun1(); 
  getchar();
  return0;  
Now, if we compile the above code with command “gcc file2.c file1.c”, we get the error “undefined reference to `fun1’” . This is because fun1() is declared static in file1.c and cannot be used in file2.c.

  •  static variable

1) A static int variable remains in memory while the program is running. A normal or auto variable is destroyed when a function call where the variable was declared is over.

2) Static variables are allocated memory in data segment, not stack segment. See memory layout of C programs for details.

3) Static variables (like global variables) are initialized as 0 if not initialized explicitly. For example in the below program, value of x is printed as 0, while value of y is something garbage. See this for more details.

 

4) In C, static variables can only be initialized using constant literals. For example, following program fails in compilation. See this for more details.