* #27232: jni: added pjproject checkout as regular git content
We will remove it once the next release of pjsip (with Android support)
comes out and is merged into SFLphone.
diff --git a/jni/pjproject-android/.svn/pristine/9e/9e0d7beaac8c0505ecd793ecce1b40f3d46118dd.svn-base b/jni/pjproject-android/.svn/pristine/9e/9e0d7beaac8c0505ecd793ecce1b40f3d46118dd.svn-base
new file mode 100644
index 0000000..396fcb1
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/9e/9e0d7beaac8c0505ecd793ecce1b40f3d46118dd.svn-base
@@ -0,0 +1,4617 @@
+/* Included by resamplesubs.c */
+#define SMALL_FILTER_NMULT ((RES_HWORD)13)
+#define SMALL_FILTER_SCALE 13128 /* Unity-gain scale factor */
+#define SMALL_FILTER_NWING 1536 /* Filter table length */
+static const RES_HWORD SMALL_FILTER_IMP[] /* Impulse response */ = {
+32767,
+32766,
+32764,
+32760,
+32755,
+32749,
+32741,
+32731,
+32721,
+32708,
+32695,
+32679,
+32663,
+32645,
+32625,
+32604,
+32582,
+32558,
+32533,
+32506,
+32478,
+32448,
+32417,
+32385,
+32351,
+32316,
+32279,
+32241,
+32202,
+32161,
+32119,
+32075,
+32030,
+31984,
+31936,
+31887,
+31836,
+31784,
+31731,
+31676,
+31620,
+31563,
+31504,
+31444,
+31383,
+31320,
+31256,
+31191,
+31124,
+31056,
+30987,
+30916,
+30845,
+30771,
+30697,
+30621,
+30544,
+30466,
+30387,
+30306,
+30224,
+30141,
+30057,
+29971,
+29884,
+29796,
+29707,
+29617,
+29525,
+29433,
+29339,
+29244,
+29148,
+29050,
+28952,
+28852,
+28752,
+28650,
+28547,
+28443,
+28338,
+28232,
+28125,
+28017,
+27908,
+27797,
+27686,
+27574,
+27461,
+27346,
+27231,
+27115,
+26998,
+26879,
+26760,
+26640,
+26519,
+26398,
+26275,
+26151,
+26027,
+25901,
+25775,
+25648,
+25520,
+25391,
+25262,
+25131,
+25000,
+24868,
+24735,
+24602,
+24467,
+24332,
+24197,
+24060,
+23923,
+23785,
+23647,
+23507,
+23368,
+23227,
+23086,
+22944,
+22802,
+22659,
+22515,
+22371,
+22226,
+22081,
+21935,
+21789,
+21642,
+21494,
+21346,
+21198,
+21049,
+20900,
+20750,
+20600,
+20449,
+20298,
+20146,
+19995,
+19842,
+19690,
+19537,
+19383,
+19230,
+19076,
+18922,
+18767,
+18612,
+18457,
+18302,
+18146,
+17990,
+17834,
+17678,
+17521,
+17365,
+17208,
+17051,
+16894,
+16737,
+16579,
+16422,
+16264,
+16106,
+15949,
+15791,
+15633,
+15475,
+15317,
+15159,
+15001,
+14843,
+14685,
+14527,
+14369,
+14212,
+14054,
+13896,
+13739,
+13581,
+13424,
+13266,
+13109,
+12952,
+12795,
+12639,
+12482,
+12326,
+12170,
+12014,
+11858,
+11703,
+11548,
+11393,
+11238,
+11084,
+10929,
+10776,
+10622,
+10469,
+10316,
+10164,
+10011,
+9860,
+9708,
+9557,
+9407,
+9256,
+9106,
+8957,
+8808,
+8659,
+8511,
+8364,
+8216,
+8070,
+7924,
+7778,
+7633,
+7488,
+7344,
+7200,
+7057,
+6914,
+6773,
+6631,
+6490,
+6350,
+6210,
+6071,
+5933,
+5795,
+5658,
+5521,
+5385,
+5250,
+5115,
+4981,
+4848,
+4716,
+4584,
+4452,
+4322,
+4192,
+4063,
+3935,
+3807,
+3680,
+3554,
+3429,
+3304,
+3180,
+3057,
+2935,
+2813,
+2692,
+2572,
+2453,
+2335,
+2217,
+2101,
+1985,
+1870,
+1755,
+1642,
+1529,
+1418,
+1307,
+1197,
+1088,
+979,
+872,
+765,
+660,
+555,
+451,
+348,
+246,
+145,
+44,
+-54,
+-153,
+-250,
+-347,
+-443,
+-537,
+-631,
+-724,
+-816,
+-908,
+-998,
+-1087,
+-1175,
+-1263,
+-1349,
+-1435,
+-1519,
+-1603,
+-1685,
+-1767,
+-1848,
+-1928,
+-2006,
+-2084,
+-2161,
+-2237,
+-2312,
+-2386,
+-2459,
+-2531,
+-2603,
+-2673,
+-2742,
+-2810,
+-2878,
+-2944,
+-3009,
+-3074,
+-3137,
+-3200,
+-3261,
+-3322,
+-3381,
+-3440,
+-3498,
+-3554,
+-3610,
+-3665,
+-3719,
+-3772,
+-3824,
+-3875,
+-3925,
+-3974,
+-4022,
+-4069,
+-4116,
+-4161,
+-4205,
+-4249,
+-4291,
+-4333,
+-4374,
+-4413,
+-4452,
+-4490,
+-4527,
+-4563,
+-4599,
+-4633,
+-4666,
+-4699,
+-4730,
+-4761,
+-4791,
+-4820,
+-4848,
+-4875,
+-4901,
+-4926,
+-4951,
+-4974,
+-4997,
+-5019,
+-5040,
+-5060,
+-5080,
+-5098,
+-5116,
+-5133,
+-5149,
+-5164,
+-5178,
+-5192,
+-5205,
+-5217,
+-5228,
+-5238,
+-5248,
+-5257,
+-5265,
+-5272,
+-5278,
+-5284,
+-5289,
+-5293,
+-5297,
+-5299,
+-5301,
+-5303,
+-5303,
+-5303,
+-5302,
+-5300,
+-5298,
+-5295,
+-5291,
+-5287,
+-5282,
+-5276,
+-5270,
+-5263,
+-5255,
+-5246,
+-5237,
+-5228,
+-5217,
+-5206,
+-5195,
+-5183,
+-5170,
+-5157,
+-5143,
+-5128,
+-5113,
+-5097,
+-5081,
+-5064,
+-5047,
+-5029,
+-5010,
+-4991,
+-4972,
+-4952,
+-4931,
+-4910,
+-4889,
+-4867,
+-4844,
+-4821,
+-4797,
+-4774,
+-4749,
+-4724,
+-4699,
+-4673,
+-4647,
+-4620,
+-4593,
+-4566,
+-4538,
+-4510,
+-4481,
+-4452,
+-4422,
+-4393,
+-4363,
+-4332,
+-4301,
+-4270,
+-4238,
+-4206,
+-4174,
+-4142,
+-4109,
+-4076,
+-4042,
+-4009,
+-3975,
+-3940,
+-3906,
+-3871,
+-3836,
+-3801,
+-3765,
+-3729,
+-3693,
+-3657,
+-3620,
+-3584,
+-3547,
+-3510,
+-3472,
+-3435,
+-3397,
+-3360,
+-3322,
+-3283,
+-3245,
+-3207,
+-3168,
+-3129,
+-3091,
+-3052,
+-3013,
+-2973,
+-2934,
+-2895,
+-2855,
+-2816,
+-2776,
+-2736,
+-2697,
+-2657,
+-2617,
+-2577,
+-2537,
+-2497,
+-2457,
+-2417,
+-2377,
+-2337,
+-2297,
+-2256,
+-2216,
+-2176,
+-2136,
+-2096,
+-2056,
+-2016,
+-1976,
+-1936,
+-1896,
+-1856,
+-1817,
+-1777,
+-1737,
+-1698,
+-1658,
+-1619,
+-1579,
+-1540,
+-1501,
+-1462,
+-1423,
+-1384,
+-1345,
+-1306,
+-1268,
+-1230,
+-1191,
+-1153,
+-1115,
+-1077,
+-1040,
+-1002,
+-965,
+-927,
+-890,
+-854,
+-817,
+-780,
+-744,
+-708,
+-672,
+-636,
+-600,
+-565,
+-530,
+-494,
+-460,
+-425,
+-391,
+-356,
+-322,
+-289,
+-255,
+-222,
+-189,
+-156,
+-123,
+-91,
+-59,
+-27,
+4,
+35,
+66,
+97,
+127,
+158,
+188,
+218,
+247,
+277,
+306,
+334,
+363,
+391,
+419,
+447,
+474,
+501,
+528,
+554,
+581,
+606,
+632,
+657,
+683,
+707,
+732,
+756,
+780,
+803,
+827,
+850,
+872,
+895,
+917,
+939,
+960,
+981,
+1002,
+1023,
+1043,
+1063,
+1082,
+1102,
+1121,
+1139,
+1158,
+1176,
+1194,
+1211,
+1228,
+1245,
+1262,
+1278,
+1294,
+1309,
+1325,
+1340,
+1354,
+1369,
+1383,
+1397,
+1410,
+1423,
+1436,
+1448,
+1461,
+1473,
+1484,
+1496,
+1507,
+1517,
+1528,
+1538,
+1548,
+1557,
+1566,
+1575,
+1584,
+1592,
+1600,
+1608,
+1616,
+1623,
+1630,
+1636,
+1643,
+1649,
+1654,
+1660,
+1665,
+1670,
+1675,
+1679,
+1683,
+1687,
+1690,
+1694,
+1697,
+1700,
+1702,
+1704,
+1706,
+1708,
+1709,
+1711,
+1712,
+1712,
+1713,
+1713,
+1713,
+1713,
+1712,
+1711,
+1710,
+1709,
+1708,
+1706,
+1704,
+1702,
+1700,
+1697,
+1694,
+1691,
+1688,
+1685,
+1681,
+1677,
+1673,
+1669,
+1664,
+1660,
+1655,
+1650,
+1644,
+1639,
+1633,
+1627,
+1621,
+1615,
+1609,
+1602,
+1596,
+1589,
+1582,
+1575,
+1567,
+1560,
+1552,
+1544,
+1536,
+1528,
+1520,
+1511,
+1503,
+1494,
+1485,
+1476,
+1467,
+1458,
+1448,
+1439,
+1429,
+1419,
+1409,
+1399,
+1389,
+1379,
+1368,
+1358,
+1347,
+1337,
+1326,
+1315,
+1304,
+1293,
+1282,
+1271,
+1260,
+1248,
+1237,
+1225,
+1213,
+1202,
+1190,
+1178,
+1166,
+1154,
+1142,
+1130,
+1118,
+1106,
+1094,
+1081,
+1069,
+1057,
+1044,
+1032,
+1019,
+1007,
+994,
+981,
+969,
+956,
+943,
+931,
+918,
+905,
+892,
+879,
+867,
+854,
+841,
+828,
+815,
+802,
+790,
+777,
+764,
+751,
+738,
+725,
+713,
+700,
+687,
+674,
+662,
+649,
+636,
+623,
+611,
+598,
+585,
+573,
+560,
+548,
+535,
+523,
+510,
+498,
+486,
+473,
+461,
+449,
+437,
+425,
+413,
+401,
+389,
+377,
+365,
+353,
+341,
+330,
+318,
+307,
+295,
+284,
+272,
+261,
+250,
+239,
+228,
+217,
+206,
+195,
+184,
+173,
+163,
+152,
+141,
+131,
+121,
+110,
+100,
+90,
+80,
+70,
+60,
+51,
+41,
+31,
+22,
+12,
+3,
+-5,
+-14,
+-23,
+-32,
+-41,
+-50,
+-59,
+-67,
+-76,
+-84,
+-93,
+-101,
+-109,
+-117,
+-125,
+-133,
+-140,
+-148,
+-156,
+-163,
+-170,
+-178,
+-185,
+-192,
+-199,
+-206,
+-212,
+-219,
+-226,
+-232,
+-239,
+-245,
+-251,
+-257,
+-263,
+-269,
+-275,
+-280,
+-286,
+-291,
+-297,
+-302,
+-307,
+-312,
+-317,
+-322,
+-327,
+-332,
+-336,
+-341,
+-345,
+-349,
+-354,
+-358,
+-362,
+-366,
+-369,
+-373,
+-377,
+-380,
+-384,
+-387,
+-390,
+-394,
+-397,
+-400,
+-402,
+-405,
+-408,
+-411,
+-413,
+-416,
+-418,
+-420,
+-422,
+-424,
+-426,
+-428,
+-430,
+-432,
+-433,
+-435,
+-436,
+-438,
+-439,
+-440,
+-442,
+-443,
+-444,
+-445,
+-445,
+-446,
+-447,
+-447,
+-448,
+-448,
+-449,
+-449,
+-449,
+-449,
+-449,
+-449,
+-449,
+-449,
+-449,
+-449,
+-449,
+-448,
+-448,
+-447,
+-447,
+-446,
+-445,
+-444,
+-443,
+-443,
+-442,
+-441,
+-440,
+-438,
+-437,
+-436,
+-435,
+-433,
+-432,
+-430,
+-429,
+-427,
+-426,
+-424,
+-422,
+-420,
+-419,
+-417,
+-415,
+-413,
+-411,
+-409,
+-407,
+-405,
+-403,
+-400,
+-398,
+-396,
+-393,
+-391,
+-389,
+-386,
+-384,
+-381,
+-379,
+-376,
+-374,
+-371,
+-368,
+-366,
+-363,
+-360,
+-357,
+-355,
+-352,
+-349,
+-346,
+-343,
+-340,
+-337,
+-334,
+-331,
+-328,
+-325,
+-322,
+-319,
+-316,
+-313,
+-310,
+-307,
+-304,
+-301,
+-298,
+-294,
+-291,
+-288,
+-285,
+-282,
+-278,
+-275,
+-272,
+-269,
+-265,
+-262,
+-259,
+-256,
+-252,
+-249,
+-246,
+-243,
+-239,
+-236,
+-233,
+-230,
+-226,
+-223,
+-220,
+-217,
+-213,
+-210,
+-207,
+-204,
+-200,
+-197,
+-194,
+-191,
+-187,
+-184,
+-181,
+-178,
+-175,
+-172,
+-168,
+-165,
+-162,
+-159,
+-156,
+-153,
+-150,
+-147,
+-143,
+-140,
+-137,
+-134,
+-131,
+-128,
+-125,
+-122,
+-120,
+-117,
+-114,
+-111,
+-108,
+-105,
+-102,
+-99,
+-97,
+-94,
+-91,
+-88,
+-86,
+-83,
+-80,
+-78,
+-75,
+-72,
+-70,
+-67,
+-65,
+-62,
+-59,
+-57,
+-55,
+-52,
+-50,
+-47,
+-45,
+-43,
+-40,
+-38,
+-36,
+-33,
+-31,
+-29,
+-27,
+-25,
+-22,
+-20,
+-18,
+-16,
+-14,
+-12,
+-10,
+-8,
+-6,
+-4,
+-2,
+0,
+0,
+2,
+4,
+6,
+8,
+9,
+11,
+13,
+14,
+16,
+17,
+19,
+21,
+22,
+24,
+25,
+27,
+28,
+29,
+31,
+32,
+33,
+35,
+36,
+37,
+38,
+40,
+41,
+42,
+43,
+44,
+45,
+46,
+47,
+48,
+49,
+50,
+51,
+52,
+53,
+54,
+55,
+56,
+56,
+57,
+58,
+59,
+59,
+60,
+61,
+62,
+62,
+63,
+63,
+64,
+64,
+65,
+66,
+66,
+66,
+67,
+67,
+68,
+68,
+69,
+69,
+69,
+70,
+70,
+70,
+70,
+71,
+71,
+71,
+71,
+71,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+71,
+71,
+71,
+71,
+71,
+70,
+70,
+70,
+70,
+69,
+69,
+69,
+69,
+68,
+68,
+68,
+67,
+67,
+67,
+66,
+66,
+66,
+65,
+65,
+64,
+64,
+64,
+63,
+63,
+62,
+62,
+62,
+61,
+61,
+60,
+60,
+59,
+59,
+58,
+58,
+58,
+57,
+57,
+56,
+56,
+55,
+55,
+54,
+54,
+53,
+53,
+52,
+52,
+51,
+51,
+50,
+50,
+49,
+48,
+48,
+47,
+47,
+46,
+46,
+45,
+45,
+44,
+44,
+43,
+43,
+42,
+42,
+41,
+41,
+40,
+39,
+39,
+38,
+38,
+37,
+37,
+36,
+36,
+35,
+35,
+34,
+34,
+33,
+33,
+32,
+32,
+31,
+31,
+30,
+30,
+29,
+29,
+28,
+28,
+27,
+27,
+26,
+26,
+25,
+25,
+24,
+24,
+23,
+23,
+23,
+22,
+22,
+21,
+21,
+20,
+20,
+20,
+19,
+19,
+18,
+18,
+17,
+17,
+17,
+16,
+16,
+15,
+15,
+15,
+14,
+14,
+14,
+13,
+13,
+12,
+12,
+12,
+11,
+11,
+11,
+10,
+10,
+10,
+9,
+9,
+9,
+9,
+8,
+8,
+8,
+7,
+7,
+7,
+7,
+6,
+6,
+6,
+6,
+5,
+5,
+5,
+5,
+4,
+4,
+4,
+4,
+3,
+3,
+3,
+3,
+3,
+2,
+2,
+2,
+2,
+2,
+1,
+1,
+1,
+1,
+1,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1
+};
+
+static const RES_HWORD SMALL_FILTER_IMPD[] = {
+-1,
+-2,
+-4,
+-5,
+-6,
+-8,
+-10,
+-10,
+-13,
+-13,
+-16,
+-16,
+-18,
+-20,
+-21,
+-22,
+-24,
+-25,
+-27,
+-28,
+-30,
+-31,
+-32,
+-34,
+-35,
+-37,
+-38,
+-39,
+-41,
+-42,
+-44,
+-45,
+-46,
+-48,
+-49,
+-51,
+-52,
+-53,
+-55,
+-56,
+-57,
+-59,
+-60,
+-61,
+-63,
+-64,
+-65,
+-67,
+-68,
+-69,
+-71,
+-71,
+-74,
+-74,
+-76,
+-77,
+-78,
+-79,
+-81,
+-82,
+-83,
+-84,
+-86,
+-87,
+-88,
+-89,
+-90,
+-92,
+-92,
+-94,
+-95,
+-96,
+-98,
+-98,
+-100,
+-100,
+-102,
+-103,
+-104,
+-105,
+-106,
+-107,
+-108,
+-109,
+-111,
+-111,
+-112,
+-113,
+-115,
+-115,
+-116,
+-117,
+-119,
+-119,
+-120,
+-121,
+-121,
+-123,
+-124,
+-124,
+-126,
+-126,
+-127,
+-128,
+-129,
+-129,
+-131,
+-131,
+-132,
+-133,
+-133,
+-135,
+-135,
+-135,
+-137,
+-137,
+-138,
+-138,
+-140,
+-139,
+-141,
+-141,
+-142,
+-142,
+-143,
+-144,
+-144,
+-145,
+-145,
+-146,
+-146,
+-147,
+-148,
+-148,
+-148,
+-149,
+-149,
+-150,
+-150,
+-151,
+-151,
+-152,
+-151,
+-153,
+-152,
+-153,
+-154,
+-153,
+-154,
+-154,
+-155,
+-155,
+-155,
+-155,
+-156,
+-156,
+-156,
+-156,
+-157,
+-156,
+-157,
+-157,
+-157,
+-157,
+-158,
+-157,
+-158,
+-158,
+-157,
+-158,
+-158,
+-158,
+-158,
+-158,
+-158,
+-158,
+-158,
+-158,
+-158,
+-157,
+-158,
+-158,
+-157,
+-158,
+-157,
+-158,
+-157,
+-157,
+-157,
+-156,
+-157,
+-156,
+-156,
+-156,
+-156,
+-155,
+-155,
+-155,
+-155,
+-154,
+-155,
+-153,
+-154,
+-153,
+-153,
+-152,
+-153,
+-151,
+-152,
+-151,
+-150,
+-151,
+-150,
+-149,
+-149,
+-149,
+-148,
+-147,
+-148,
+-146,
+-146,
+-146,
+-145,
+-145,
+-144,
+-144,
+-143,
+-143,
+-141,
+-142,
+-141,
+-140,
+-140,
+-139,
+-138,
+-138,
+-137,
+-137,
+-136,
+-135,
+-135,
+-134,
+-133,
+-132,
+-132,
+-132,
+-130,
+-130,
+-129,
+-128,
+-128,
+-127,
+-126,
+-125,
+-125,
+-124,
+-123,
+-122,
+-122,
+-121,
+-120,
+-119,
+-118,
+-118,
+-116,
+-116,
+-115,
+-115,
+-113,
+-113,
+-111,
+-111,
+-110,
+-109,
+-109,
+-107,
+-107,
+-105,
+-105,
+-104,
+-103,
+-102,
+-101,
+-101,
+-98,
+-99,
+-97,
+-97,
+-96,
+-94,
+-94,
+-93,
+-92,
+-92,
+-90,
+-89,
+-88,
+-88,
+-86,
+-86,
+-84,
+-84,
+-82,
+-82,
+-81,
+-80,
+-78,
+-78,
+-77,
+-76,
+-75,
+-74,
+-73,
+-72,
+-72,
+-70,
+-69,
+-68,
+-68,
+-66,
+-65,
+-65,
+-63,
+-63,
+-61,
+-61,
+-59,
+-59,
+-58,
+-56,
+-56,
+-55,
+-54,
+-53,
+-52,
+-51,
+-50,
+-49,
+-48,
+-47,
+-47,
+-45,
+-44,
+-44,
+-42,
+-42,
+-41,
+-39,
+-39,
+-38,
+-37,
+-36,
+-36,
+-34,
+-33,
+-33,
+-31,
+-31,
+-30,
+-29,
+-28,
+-27,
+-26,
+-25,
+-25,
+-23,
+-23,
+-22,
+-21,
+-20,
+-20,
+-18,
+-18,
+-17,
+-16,
+-15,
+-14,
+-14,
+-13,
+-12,
+-11,
+-10,
+-10,
+-9,
+-8,
+-7,
+-6,
+-6,
+-5,
+-4,
+-4,
+-2,
+-2,
+-2,
+0,
+0,
+1,
+2,
+2,
+3,
+4,
+4,
+5,
+6,
+6,
+7,
+8,
+9,
+9,
+9,
+11,
+11,
+11,
+12,
+13,
+13,
+14,
+15,
+15,
+16,
+16,
+17,
+17,
+18,
+19,
+19,
+19,
+20,
+21,
+21,
+21,
+22,
+23,
+23,
+24,
+23,
+25,
+25,
+25,
+26,
+26,
+27,
+27,
+27,
+28,
+28,
+29,
+29,
+30,
+29,
+30,
+31,
+31,
+31,
+32,
+32,
+32,
+32,
+33,
+33,
+34,
+33,
+34,
+35,
+34,
+35,
+35,
+35,
+36,
+36,
+36,
+36,
+37,
+36,
+37,
+37,
+38,
+37,
+38,
+37,
+38,
+39,
+38,
+38,
+39,
+39,
+38,
+39,
+39,
+40,
+39,
+39,
+40,
+39,
+40,
+40,
+39,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+41,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+39,
+40,
+40,
+39,
+40,
+39,
+40,
+39,
+39,
+39,
+39,
+39,
+39,
+39,
+38,
+38,
+39,
+38,
+38,
+38,
+37,
+38,
+37,
+38,
+37,
+36,
+37,
+37,
+36,
+36,
+36,
+36,
+36,
+35,
+35,
+36,
+34,
+35,
+34,
+35,
+34,
+33,
+34,
+33,
+33,
+33,
+33,
+32,
+32,
+32,
+31,
+31,
+31,
+31,
+30,
+31,
+30,
+30,
+29,
+30,
+29,
+28,
+29,
+28,
+28,
+28,
+27,
+27,
+27,
+26,
+27,
+25,
+26,
+25,
+26,
+24,
+25,
+24,
+24,
+23,
+24,
+23,
+22,
+23,
+22,
+22,
+21,
+21,
+21,
+21,
+20,
+20,
+19,
+20,
+19,
+18,
+19,
+18,
+18,
+17,
+17,
+17,
+17,
+16,
+16,
+15,
+16,
+15,
+14,
+15,
+14,
+14,
+13,
+13,
+13,
+12,
+13,
+12,
+11,
+12,
+11,
+10,
+11,
+10,
+10,
+9,
+9,
+9,
+9,
+8,
+8,
+8,
+8,
+7,
+7,
+6,
+7,
+6,
+5,
+6,
+5,
+5,
+5,
+4,
+4,
+4,
+3,
+4,
+3,
+3,
+2,
+2,
+2,
+2,
+1,
+2,
+1,
+0,
+1,
+0,
+0,
+0,
+-1,
+-1,
+-1,
+-1,
+-1,
+-2,
+-2,
+-2,
+-2,
+-3,
+-3,
+-3,
+-3,
+-3,
+-4,
+-4,
+-4,
+-4,
+-5,
+-4,
+-5,
+-5,
+-6,
+-5,
+-6,
+-6,
+-6,
+-6,
+-6,
+-7,
+-6,
+-7,
+-7,
+-7,
+-8,
+-7,
+-8,
+-8,
+-8,
+-8,
+-8,
+-9,
+-8,
+-9,
+-9,
+-9,
+-9,
+-9,
+-10,
+-9,
+-10,
+-10,
+-10,
+-10,
+-10,
+-10,
+-11,
+-10,
+-11,
+-10,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-12,
+-11,
+-12,
+-12,
+-11,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-13,
+-12,
+-12,
+-13,
+-12,
+-13,
+-12,
+-13,
+-13,
+-12,
+-13,
+-13,
+-12,
+-13,
+-13,
+-13,
+-13,
+-12,
+-13,
+-13,
+-13,
+-13,
+-13,
+-12,
+-13,
+-13,
+-13,
+-13,
+-13,
+-12,
+-13,
+-13,
+-13,
+-12,
+-13,
+-13,
+-13,
+-12,
+-13,
+-13,
+-12,
+-13,
+-12,
+-13,
+-12,
+-13,
+-12,
+-12,
+-13,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-11,
+-12,
+-11,
+-12,
+-11,
+-12,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-10,
+-11,
+-11,
+-10,
+-10,
+-11,
+-10,
+-10,
+-10,
+-10,
+-10,
+-9,
+-10,
+-10,
+-9,
+-10,
+-9,
+-8,
+-9,
+-9,
+-9,
+-9,
+-9,
+-9,
+-8,
+-9,
+-8,
+-9,
+-8,
+-8,
+-8,
+-8,
+-8,
+-7,
+-8,
+-8,
+-7,
+-7,
+-8,
+-7,
+-7,
+-7,
+-7,
+-6,
+-7,
+-7,
+-6,
+-7,
+-6,
+-6,
+-6,
+-6,
+-6,
+-6,
+-5,
+-6,
+-5,
+-6,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-4,
+-5,
+-4,
+-4,
+-5,
+-4,
+-4,
+-4,
+-3,
+-4,
+-4,
+-3,
+-4,
+-3,
+-3,
+-4,
+-3,
+-3,
+-2,
+-3,
+-3,
+-3,
+-2,
+-3,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-1,
+-2,
+-1,
+-2,
+-1,
+-1,
+-2,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+1,
+0,
+1,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+2,
+1,
+1,
+1,
+2,
+1,
+2,
+1,
+2,
+1,
+2,
+2,
+2,
+1,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+3,
+2,
+2,
+3,
+2,
+2,
+3,
+2,
+3,
+2,
+3,
+2,
+3,
+3,
+2,
+3,
+3,
+3,
+2,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+2,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+2,
+3,
+3,
+3,
+2,
+3,
+3,
+2,
+3,
+3,
+2,
+3,
+2,
+3,
+3,
+2,
+2,
+3,
+2,
+3,
+2,
+2,
+3,
+2,
+2,
+3,
+2,
+2,
+2,
+2,
+3,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+0,
+2,
+2,
+2,
+2,
+1,
+2,
+2,
+1,
+2,
+1,
+2,
+2,
+1,
+2,
+1,
+2,
+1,
+1,
+2,
+1,
+1,
+2,
+1,
+1,
+1,
+2,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+1,
+0,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+-1,
+-2,
+-4,
+-5,
+-6,
+-8,
+-10,
+-10,
+-13,
+-13,
+-16,
+-16,
+-18,
+-20,
+-21,
+-22,
+-24,
+-25,
+-27,
+-28,
+-30,
+-31,
+-32,
+-34,
+-35,
+-37,
+-38,
+-39,
+-41,
+-42,
+-44,
+-45,
+-46,
+-48,
+-49,
+-51,
+-52,
+-53,
+-55,
+-56,
+-57,
+-59,
+-60,
+-61,
+-63,
+-64,
+-65,
+-67,
+-68,
+-69,
+-71,
+-71,
+-74,
+-74,
+-76,
+-77,
+-78,
+-79,
+-81,
+-82,
+-83,
+-84,
+-86,
+-87,
+-88,
+-89,
+-90,
+-92,
+-92,
+-94,
+-95,
+-96,
+-98,
+-98,
+-100,
+-100,
+-102,
+-103,
+-104,
+-105,
+-106,
+-107,
+-108,
+-109,
+-111,
+-111,
+-112,
+-113,
+-115,
+-115,
+-116,
+-117,
+-119,
+-119,
+-120,
+-121,
+-121,
+-123,
+-124,
+-124,
+-126,
+-126,
+-127,
+-128,
+-129,
+-129,
+-131,
+-131,
+-132,
+-133,
+-133,
+-135,
+-135,
+-135,
+-137,
+-137,
+-138,
+-138,
+-140,
+-139,
+-141,
+-141,
+-142,
+-142,
+-143,
+-144,
+-144,
+-145,
+-145,
+-146,
+-146,
+-147,
+-148,
+-148,
+-148,
+-149,
+-149,
+-150,
+-150,
+-151,
+-151,
+-152,
+-151,
+-153,
+-152,
+-153,
+-154,
+-153,
+-154,
+-154,
+-155,
+-155,
+-155,
+-155,
+-156,
+-156,
+-156,
+-156,
+-157,
+-156,
+-157,
+-157,
+-157,
+-157,
+-158,
+-157,
+-158,
+-158,
+-157,
+-158,
+-158,
+-158,
+-158,
+-158,
+-158,
+-158,
+-158,
+-158,
+-158,
+-157,
+-158,
+-158,
+-157,
+-158,
+-157,
+-158,
+-157,
+-157,
+-157,
+-156,
+-157,
+-156,
+-156,
+-156,
+-156,
+-155,
+-155,
+-155,
+-155,
+-154,
+-155,
+-153,
+-154,
+-153,
+-153,
+-152,
+-153,
+-151,
+-152,
+-151,
+-150,
+-151,
+-150,
+-149,
+-149,
+-149,
+-148,
+-147,
+-148,
+-146,
+-146,
+-146,
+-145,
+-145,
+-144,
+-144,
+-143,
+-143,
+-141,
+-142,
+-141,
+-140,
+-140,
+-139,
+-138,
+-138,
+-137,
+-137,
+-136,
+-135,
+-135,
+-134,
+-133,
+-132,
+-132,
+-132,
+-130,
+-130,
+-129,
+-128,
+-128,
+-127,
+-126,
+-125,
+-125,
+-124,
+-123,
+-122,
+-122,
+-121,
+-120,
+-119,
+-118,
+-118,
+-116,
+-116,
+-115,
+-115,
+-113,
+-113,
+-111,
+-111,
+-110,
+-109,
+-109,
+-107,
+-107,
+-105,
+-105,
+-104,
+-103,
+-102,
+-101,
+-101,
+-98,
+-99,
+-97,
+-97,
+-96,
+-94,
+-94,
+-93,
+-92,
+-92,
+-90,
+-89,
+-88,
+-88,
+-86,
+-86,
+-84,
+-84,
+-82,
+-82,
+-81,
+-80,
+-78,
+-78,
+-77,
+-76,
+-75,
+-74,
+-73,
+-72,
+-72,
+-70,
+-69,
+-68,
+-68,
+-66,
+-65,
+-65,
+-63,
+-63,
+-61,
+-61,
+-59,
+-59,
+-58,
+-56,
+-56,
+-55,
+-54,
+-53,
+-52,
+-51,
+-50,
+-49,
+-48,
+-47,
+-47,
+-45,
+-44,
+-44,
+-42,
+-42,
+-41,
+-39,
+-39,
+-38,
+-37,
+-36,
+-36,
+-34,
+-33,
+-33,
+-31,
+-31,
+-30,
+-29,
+-28,
+-27,
+-26,
+-25,
+-25,
+-23,
+-23,
+-22,
+-21,
+-20,
+-20,
+-18,
+-18,
+-17,
+-16,
+-15,
+-14,
+-14,
+-13,
+-12,
+-11,
+-10,
+-10,
+-9,
+-8,
+-7,
+-6,
+-6,
+-5,
+-4,
+-4,
+-2,
+-2,
+-2,
+0,
+0,
+1,
+2,
+2,
+3,
+4,
+4,
+5,
+6,
+6,
+7,
+8,
+9,
+9,
+9,
+11,
+11,
+11,
+12,
+13,
+13,
+14,
+15,
+15,
+16,
+16,
+17,
+17,
+18,
+19,
+19,
+19,
+20,
+21,
+21,
+21,
+22,
+23,
+23,
+24,
+23,
+25,
+25,
+25,
+26,
+26,
+27,
+27,
+27,
+28,
+28,
+29,
+29,
+30,
+29,
+30,
+31,
+31,
+31,
+32,
+32,
+32,
+32,
+33,
+33,
+34,
+33,
+34,
+35,
+34,
+35,
+35,
+35,
+36,
+36,
+36,
+36,
+37,
+36,
+37,
+37,
+38,
+37,
+38,
+37,
+38,
+39,
+38,
+38,
+39,
+39,
+38,
+39,
+39,
+40,
+39,
+39,
+40,
+39,
+40,
+40,
+39,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+41,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+39,
+40,
+40,
+39,
+40,
+39,
+40,
+39,
+39,
+39,
+39,
+39,
+39,
+39,
+38,
+38,
+39,
+38,
+38,
+38,
+37,
+38,
+37,
+38,
+37,
+36,
+37,
+37,
+36,
+36,
+36,
+36,
+36,
+35,
+35,
+36,
+34,
+35,
+34,
+35,
+34,
+33,
+34,
+33,
+33,
+33,
+33,
+32,
+32,
+32,
+31,
+31,
+31,
+31,
+30,
+31,
+30,
+30,
+29,
+30,
+29,
+28,
+29,
+28,
+28,
+28,
+27,
+27,
+27,
+26,
+27,
+25,
+26,
+25,
+26,
+24,
+25,
+24,
+24,
+23,
+24,
+23,
+22,
+23,
+22,
+22,
+21,
+21,
+21,
+21,
+20,
+20,
+19,
+20,
+19,
+18,
+19,
+18,
+18,
+17,
+17,
+17,
+17,
+16,
+16,
+15,
+16,
+15,
+14,
+15,
+14,
+14,
+13,
+13,
+13,
+12,
+13,
+12,
+11,
+12,
+11,
+10,
+11,
+10,
+10,
+9,
+9,
+9,
+9,
+8,
+8,
+8,
+8,
+7,
+7,
+6,
+7,
+6,
+5,
+6,
+5,
+5,
+5,
+4,
+4,
+4,
+3,
+4,
+3,
+3,
+2,
+2,
+2,
+2,
+1,
+2,
+1,
+0,
+1,
+0,
+0,
+0,
+-1,
+-1,
+-1,
+-1,
+-1,
+-2,
+-2,
+-2,
+-2,
+-3,
+-3,
+-3,
+-3,
+-3,
+-4,
+-4,
+-4,
+-4,
+-5,
+-4,
+-5,
+-5,
+-6,
+-5,
+-6,
+-6,
+-6,
+-6,
+-6,
+-7,
+-6,
+-7,
+-7,
+-7,
+-8,
+-7,
+-8,
+-8,
+-8,
+-8,
+-8,
+-9,
+-8,
+-9,
+-9,
+-9,
+-9,
+-9,
+-10,
+-9,
+-10,
+-10,
+-10,
+-10,
+-10,
+-10,
+-11,
+-10,
+-11,
+-10,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-12,
+-11,
+-12,
+-12,
+-11,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-13,
+-12,
+-12,
+-13,
+-12,
+-13,
+-12,
+-13,
+-13,
+-12,
+-13,
+-13,
+-12,
+-13,
+-13,
+-13,
+-13,
+-12,
+-13,
+-13,
+-13,
+-13,
+-13,
+-12,
+-13,
+-13,
+-13,
+-13,
+-13,
+-12,
+-13,
+-13,
+-13,
+-12,
+-13,
+-13,
+-13,
+-12,
+-13,
+-13,
+-12,
+-13,
+-12,
+-13,
+-12,
+-13,
+-12,
+-12,
+-13,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-11,
+-12,
+-11,
+-12,
+-11,
+-12,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-10,
+-11,
+-11,
+-10,
+-10,
+-11,
+-10,
+-10,
+-10,
+-10,
+-10,
+-9,
+-10,
+-10,
+-9,
+-10,
+-9,
+-8,
+-9,
+-9,
+-9,
+-9,
+-9,
+-9,
+-8,
+-9,
+-8,
+-9,
+-8,
+-8,
+-8,
+-8,
+-8,
+-7,
+-8,
+-8,
+-7,
+-7,
+-8,
+-7,
+-7,
+-7,
+-7,
+-6,
+-7,
+-7,
+-6,
+-7,
+-6,
+-6,
+-6,
+-6,
+-6,
+-6,
+-5,
+-6,
+-5,
+-6,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-4,
+-5,
+-4,
+-4,
+-5,
+-4,
+-4,
+-4,
+-3,
+-4,
+-4,
+-3,
+-4,
+-3,
+-3,
+-4,
+-3,
+-3,
+-2,
+-3,
+-3,
+-3,
+-2,
+-3,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-1,
+-2,
+-1,
+-2,
+-1,
+-1,
+-2,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+1,
+0,
+1,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+2,
+1,
+1,
+1,
+2,
+1,
+2,
+1,
+2,
+1,
+2,
+2,
+2,
+1,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+3,
+2,
+2,
+3,
+2,
+2,
+3,
+2,
+3,
+2,
+3,
+2,
+3,
+3,
+2,
+3,
+3,
+3,
+2,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+2,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+2,
+3,
+3,
+3,
+2,
+3,
+3,
+2,
+3,
+3,
+2,
+3,
+2,
+3,
+3,
+2,
+2,
+3,
+2,
+3,
+2,
+2,
+3,
+2,
+2,
+3,
+2,
+2,
+2,
+2,
+3,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+0,
+2,
+2,
+2,
+2,
+1,
+2,
+2,
+1,
+2,
+1,
+2,
+2,
+1,
+2,
+1,
+2,
+1,
+1,
+2,
+1,
+1,
+2,
+1,
+1,
+1,
+2,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+1,
+0,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1
+};
diff --git a/jni/pjproject-android/.svn/pristine/9e/9e102bbabca0849977b57a9db9bd1c726c820be6.svn-base b/jni/pjproject-android/.svn/pristine/9e/9e102bbabca0849977b57a9db9bd1c726c820be6.svn-base
new file mode 100644
index 0000000..6613b74
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/9e/9e102bbabca0849977b57a9db9bd1c726c820be6.svn-base
@@ -0,0 +1,26 @@
+# $Id$
+import inc_sip as sip
+import inc_sdp as sdp
+
+sdp = \
+"""
+v=0
+o=- 0 0 IN IP4 127.0.0.1
+s=tester
+c=IN IP4 127.0.0.1
+t=0 0
+m=audio 4000 RTP/SAVP 0 101
+a=rtpmap:0 PCMU/8000
+a=sendrecv
+a=rtpmap:101 telephone-event/8000
+a=fmtp:101 0-15
+"""
+
+args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 2 --srtp-secure 0"
+include = []
+exclude = []
+
+sendto_cfg = sip.SendtoCfg( "caller has no crypto attr on RTP/SAVP, callee must not accept the call",
+ pjsua_args=args, sdp=sdp, resp_code=406,
+ resp_inc=include, resp_exc=exclude)
+
diff --git a/jni/pjproject-android/.svn/pristine/9e/9e6244ef9e8e3a1cd36d5a99debd23d9b46b5128.svn-base b/jni/pjproject-android/.svn/pristine/9e/9e6244ef9e8e3a1cd36d5a99debd23d9b46b5128.svn-base
new file mode 100644
index 0000000..c3b1d8f
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/9e/9e6244ef9e8e3a1cd36d5a99debd23d9b46b5128.svn-base
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<!--
+
+ Copyright (c) 2011, 2012, 2013 Research In Motion Limited.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<qnx xmlns="http://www.qnx.com/schemas/application/1.0">
+
+<!-- BlackBerry Tablet OS application descriptor file.
+
+ Specifies parameters for identifying, installing, and launching native applications on BlackBerry Tablet OS.
+
+-->
+
+ <!-- A universally unique application identifier. Must be unique across all BlackBerry Tablet OS applications.
+ Using a reverse DNS-style name as the id is recommended. (Eg. com.example.ExampleApplication.) Required. -->
+ <id>com.example.PjsuaBB</id>
+
+ <!-- The name that is displayed in the BlackBerry Tablet OS application installer.
+ May have multiple values for each language. See samples or xsd schema file. Optional. -->
+ <name>PjsuaBB</name>
+
+ <!-- A string value of the format <0-999>.<0-999>.<0-999> that represents application version which can be used to check for application upgrade.
+ Values can also be 1-part or 2-part. It is not necessary to have a 3-part value.
+ An updated version of application must have a versionNumber value higher than the previous version. Required. -->
+ <versionNumber>1.0.0</versionNumber>
+
+ <!-- Fourth digit segment of the package version. First three segments are taken from the
+ <versionNumber> element. Must be an integer from 0 to 2^16-1 -->
+ <buildId>1</buildId>
+
+ <!-- A string value (such as "v1", "2.5", or "Alpha 1") that represents the version of the application, as it should be shown to users. Optional. -->
+ <!-- <versionLabel></versionLabel> -->
+
+ <!-- Description, displayed in the BlackBerry Tablet OS application installer.
+ May have multiple values for each language. See samples or xsd schema file. Optional. -->
+ <description>Teluu Ltd. pjsua Demo App</description>
+
+ <!-- Copyright information. Optional. -->
+ <!-- <copyright></copyright> -->
+
+ <!-- Name of author which is used for signing. Must match the developer name of your development certificate. -->
+ <author>Teluu Ltd.</author>
+
+ <!-- Unique author ID assigned by signing authority. Required if using debug tokens. -->
+ <!-- <authorId>ABC1234YjsnUk235h</authorId> -->
+
+ <initialWindow>
+ <autoOrients>true</autoOrients>
+ <systemChrome>none</systemChrome>
+ <transparent>false</transparent>
+ </initialWindow>
+
+ <!-- The category where the application appears. Either core.games or core.media. -->
+ <category>core.media</category>
+ <configuration name="Device-Debug">
+ <platformArchitecture>armle-v7</platformArchitecture>
+ <asset path="arm/o.le-v7-g/PjsuaBB" entry="true" type="Qnx/Elf">PjsuaBB</asset>
+ <asset path="/home/bennylp/Desktop/opt/bb10/lib/libopencore-amrnb.so.0" type="Qnx/Elf">lib/libopencore-amrnb.so.0</asset>
+ <asset path="/home/bennylp/Desktop/opt/bb10/lib/libopencore-amrwb.so.0" type="Qnx/Elf">lib/libopencore-amrwb.so.0</asset>
+ </configuration>
+ <configuration name="Device-Release">
+ <entryPointType>Qnx/Cascades</entryPointType>
+ <platformArchitecture>armle-v7</platformArchitecture>
+ <asset path="arm/o.le-v7/PjsuaBB.so" entry="true" type="Qnx/Elf">PjsuaBB.so</asset>
+ </configuration>
+ <configuration name="Device-Profile">
+ <platformArchitecture>armle-v7</platformArchitecture>
+ <asset path="arm-p/o.le-v7-g/PjsuaBB" entry="true" type="Qnx/Elf">PjsuaBB</asset>
+ </configuration>
+ <configuration name="Simulator-Debug">
+ <platformArchitecture>x86</platformArchitecture>
+ <asset path="x86/o-g/PjsuaBB" entry="true" type="Qnx/Elf">PjsuaBB</asset>
+ </configuration>
+
+ <!-- The icon for the application -->
+ <icon>
+ <image>icon.png</image>
+ </icon>
+
+ <asset path="icon.png">icon.png</asset>
+ <asset path="assets">assets</asset>
+
+ <!-- Locale support -->
+
+ <!-- Request permission to execute native code. Required for native applications. -->
+ <permission system="true">run_native</permission>
+ <permission>access_internet</permission>
+ <permission>record_audio</permission>
+ <permission>run_when_backgrounded</permission>
+ <env var="LD_LIBRARY_PATH" value="app/native/lib:/usr/lib/qt4/lib"/>
+
+</qnx>
diff --git a/jni/pjproject-android/.svn/pristine/9e/9e7321aa0eb26c45ec06bb04b5f0c7e76d2fe57a.svn-base b/jni/pjproject-android/.svn/pristine/9e/9e7321aa0eb26c45ec06bb04b5f0c7e76d2fe57a.svn-base
new file mode 100644
index 0000000..f1c7502
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/9e/9e7321aa0eb26c45ec06bb04b5f0c7e76d2fe57a.svn-base
@@ -0,0 +1,4 @@
+export M_CFLAGS := $(CC_DEF)PJ_M_ALPHA=1
+export M_CXXFLAGS :=
+export M_LDFLAGS :=
+export M_SOURCES :=
diff --git a/jni/pjproject-android/.svn/pristine/9e/9eb222b059ad35c0c6cb0b120cce164e5358755d.svn-base b/jni/pjproject-android/.svn/pristine/9e/9eb222b059ad35c0c6cb0b120cce164e5358755d.svn-base
new file mode 100644
index 0000000..e49490b
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/9e/9eb222b059ad35c0c6cb0b120cce164e5358755d.svn-base
@@ -0,0 +1,1930 @@
+/* $Id$ */
+/*
+ * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
+ * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <pjsua-lib/pjsua.h>
+#include "pjsua_app_common.h"
+
+#define THIS_FILE "pjsua_app_legacy.c"
+
+static pj_bool_t cmd_echo;
+
+/*
+ * Print buddy list.
+ */
+static void print_buddy_list()
+{
+ pjsua_buddy_id ids[64];
+ int i;
+ unsigned count = PJ_ARRAY_SIZE(ids);
+
+ puts("Buddy list:");
+
+ pjsua_enum_buddies(ids, &count);
+
+ if (count == 0)
+ puts(" -none-");
+ else {
+ for (i=0; i<(int)count; ++i) {
+ pjsua_buddy_info info;
+
+ if (pjsua_buddy_get_info(ids[i], &info) != PJ_SUCCESS)
+ continue;
+
+ printf(" [%2d] <%.*s> %.*s\n",
+ ids[i]+1,
+ (int)info.status_text.slen,
+ info.status_text.ptr,
+ (int)info.uri.slen,
+ info.uri.ptr);
+ }
+ }
+ puts("");
+}
+
+/*
+ * Input URL.
+ */
+static void ui_input_url(const char *title, char *buf, pj_size_t len,
+ input_result *result)
+{
+ result->nb_result = PJSUA_APP_NO_NB;
+ result->uri_result = NULL;
+
+ print_buddy_list();
+
+ printf("Choices:\n"
+ " 0 For current dialog.\n"
+ " -1 All %d buddies in buddy list\n"
+ " [1 -%2d] Select from buddy list\n"
+ " URL An URL\n"
+ " <Enter> Empty input (or 'q') to cancel\n"
+ , pjsua_get_buddy_count(), pjsua_get_buddy_count());
+ printf("%s: ", title);
+
+ fflush(stdout);
+ if (fgets(buf, (int)len, stdin) == NULL)
+ return;
+ len = strlen(buf);
+
+ /* Left trim */
+ while (pj_isspace(*buf)) {
+ ++buf;
+ --len;
+ }
+
+ /* Remove trailing newlines */
+ while (len && (buf[len-1] == '\r' || buf[len-1] == '\n'))
+ buf[--len] = '\0';
+
+ if (len == 0 || buf[0]=='q')
+ return;
+
+ if (pj_isdigit(*buf) || *buf=='-') {
+
+ unsigned i;
+
+ if (*buf=='-')
+ i = 1;
+ else
+ i = 0;
+
+ for (; i<len; ++i) {
+ if (!pj_isdigit(buf[i])) {
+ puts("Invalid input");
+ return;
+ }
+ }
+
+ result->nb_result = my_atoi(buf);
+
+ if (result->nb_result >= 0 &&
+ result->nb_result <= (int)pjsua_get_buddy_count())
+ {
+ return;
+ }
+ if (result->nb_result == -1)
+ return;
+
+ puts("Invalid input");
+ result->nb_result = PJSUA_APP_NO_NB;
+ return;
+
+ } else {
+ pj_status_t status;
+
+ if ((status=pjsua_verify_url(buf)) != PJ_SUCCESS) {
+ pjsua_perror(THIS_FILE, "Invalid URL", status);
+ return;
+ }
+
+ result->uri_result = buf;
+ }
+}
+
+static pj_bool_t simple_input(const char *title, char *buf, pj_size_t len)
+{
+ char *p;
+
+ printf("%s (empty to cancel): ", title); fflush(stdout);
+ if (fgets(buf, (int)len, stdin) == NULL)
+ return PJ_FALSE;
+
+ /* Remove trailing newlines. */
+ for (p=buf; ; ++p) {
+ if (*p=='\r' || *p=='\n') *p='\0';
+ else if (!*p) break;
+ }
+
+ if (!*buf)
+ return PJ_FALSE;
+
+ return PJ_TRUE;
+}
+
+/*
+ * Print account status.
+ */
+static void print_acc_status(int acc_id)
+{
+ char buf[80];
+ pjsua_acc_info info;
+
+ pjsua_acc_get_info(acc_id, &info);
+
+ if (!info.has_registration) {
+ pj_ansi_snprintf(buf, sizeof(buf), "%.*s",
+ (int)info.status_text.slen,
+ info.status_text.ptr);
+
+ } else {
+ pj_ansi_snprintf(buf, sizeof(buf),
+ "%d/%.*s (expires=%d)",
+ info.status,
+ (int)info.status_text.slen,
+ info.status_text.ptr,
+ info.expires);
+
+ }
+
+ printf(" %c[%2d] %.*s: %s\n", (acc_id==current_acc?'*':' '),
+ acc_id, (int)info.acc_uri.slen, info.acc_uri.ptr, buf);
+ printf(" Online status: %.*s\n",
+ (int)info.online_status_text.slen,
+ info.online_status_text.ptr);
+}
+
+/*
+ * Show a bit of help.
+ */
+static void keystroke_help()
+{
+ pjsua_acc_id acc_ids[16];
+ unsigned count = PJ_ARRAY_SIZE(acc_ids);
+ int i;
+
+ printf(">>>>\n");
+
+ pjsua_enum_accs(acc_ids, &count);
+
+ printf("Account list:\n");
+ for (i=0; i<(int)count; ++i)
+ print_acc_status(acc_ids[i]);
+
+ print_buddy_list();
+
+ //puts("Commands:");
+ puts("+=============================================================================+");
+ puts("| Call Commands: | Buddy, IM & Presence: | Account: |");
+ puts("| | | |");
+ puts("| m Make new call | +b Add new buddy .| +a Add new accnt |");
+ puts("| M Make multiple calls | -b Delete buddy | -a Delete accnt. |");
+ puts("| a Answer call | i Send IM | !a Modify accnt. |");
+ puts("| h Hangup call (ha=all) | s Subscribe presence | rr (Re-)register |");
+ puts("| H Hold call | u Unsubscribe presence | ru Unregister |");
+ puts("| v re-inVite (release hold) | t ToGgle Online status | > Cycle next ac.|");
+ puts("| U send UPDATE | T Set online status | < Cycle prev ac.|");
+ puts("| ],[ Select next/prev call +--------------------------+-------------------+");
+ puts("| x Xfer call | Media Commands: | Status & Config: |");
+ puts("| X Xfer with Replaces | | |");
+ puts("| # Send RFC 2833 DTMF | cl List ports | d Dump status |");
+ puts("| * Send DTMF with INFO | cc Connect port | dd Dump detailed |");
+ puts("| dq Dump curr. call quality | cd Disconnect port | dc Dump config |");
+ puts("| | V Adjust audio Volume | f Save config |");
+ puts("| S Send arbitrary REQUEST | Cp Codec priorities | |");
+ puts("+-----------------------------------------------------------------------------+");
+#if PJSUA_HAS_VIDEO
+ puts("| Video: \"vid help\" for more info |");
+ puts("+-----------------------------------------------------------------------------+");
+#endif
+ puts("| q QUIT L ReLoad sleep MS echo [0|1|txt] n: detect NAT type |");
+ puts("+=============================================================================+");
+
+ i = pjsua_call_get_count();
+ printf("You have %d active call%s\n", i, (i>1?"s":""));
+
+ if (current_call != PJSUA_INVALID_ID) {
+ pjsua_call_info ci;
+ if (pjsua_call_get_info(current_call, &ci)==PJ_SUCCESS)
+ printf("Current call id=%d to %.*s [%.*s]\n", current_call,
+ (int)ci.remote_info.slen, ci.remote_info.ptr,
+ (int)ci.state_text.slen, ci.state_text.ptr);
+ }
+}
+
+/* Help screen for video */
+#if PJSUA_HAS_VIDEO
+static void vid_show_help()
+{
+ pj_bool_t vid_enabled = (app_config.vid.vid_cnt > 0);
+
+ puts("+=============================================================================+");
+ puts("| Video commands: |");
+ puts("| |");
+ puts("| vid help Show this help screen |");
+ puts("| vid enable|disable Enable or disable video in next offer/answer |");
+ puts("| vid acc show Show current account video settings |");
+ puts("| vid acc autorx on|off Automatically show incoming video on/off |");
+ puts("| vid acc autotx on|off Automatically offer video on/off |");
+ puts("| vid acc cap ID Set default capture device for current acc |");
+ puts("| vid acc rend ID Set default renderer device for current acc |");
+ puts("| vid call rx on|off N Enable/disable video RX for stream N in curr call |");
+ puts("| vid call tx on|off N Enable/disable video TX for stream N in curr call |");
+ puts("| vid call add Add video stream for current call |");
+ puts("| vid call enable|disable N Enable/disable stream #N in current call |");
+ puts("| vid call cap N ID Set capture dev ID for stream #N in current call |");
+ puts("| vid dev list List all video devices |");
+ puts("| vid dev refresh Refresh video device list |");
+ puts("| vid dev prev on|off ID Enable/disable preview for specified device ID |");
+ puts("| vid codec list List video codecs |");
+ puts("| vid codec prio ID PRIO Set codec ID priority to PRIO |");
+ puts("| vid codec fps ID NUM DEN Set codec ID framerate to (NUM/DEN) fps |");
+ puts("| vid codec bw ID AVG MAX Set codec ID bitrate to AVG & MAX kbps |");
+ puts("| vid codec size ID W H Set codec ID size/resolution to W x H |");
+ puts("| vid win list List all active video windows |");
+ puts("| vid win arrange Auto arrange windows |");
+ puts("| vid win show|hide ID Show/hide the specified video window ID |");
+ puts("| vid win move ID X Y Move window ID to position X,Y |");
+ puts("| vid win resize ID w h Resize window ID to the specified width, height |");
+ puts("+=============================================================================+");
+ printf("| Video will be %s in the next offer/answer %s |\n",
+ (vid_enabled? "enabled" : "disabled"), (vid_enabled? " " : ""));
+ puts("+=============================================================================+");
+}
+
+static void vid_handle_menu(char *menuin)
+{
+ char *argv[8];
+ int argc = 0;
+
+ /* Tokenize */
+ argv[argc] = strtok(menuin, " \t\r\n");
+ while (argv[argc] && *argv[argc]) {
+ argc++;
+ argv[argc] = strtok(NULL, " \t\r\n");
+ }
+
+ if (argc == 1 || strcmp(argv[1], "help")==0) {
+ vid_show_help();
+ } else if (argc == 2 && (strcmp(argv[1], "enable")==0 ||
+ strcmp(argv[1], "disable")==0))
+ {
+ pj_bool_t enabled = (strcmp(argv[1], "enable")==0);
+ app_config.vid.vid_cnt = (enabled ? 1 : 0);
+ PJ_LOG(3,(THIS_FILE, "Video will be %s in next offer/answer",
+ (enabled?"enabled":"disabled")));
+ } else if (strcmp(argv[1], "acc")==0) {
+ pjsua_acc_config acc_cfg;
+ pj_bool_t changed = PJ_FALSE;
+
+ pjsua_acc_get_config(current_acc, &acc_cfg);
+
+ if (argc == 3 && strcmp(argv[2], "show")==0) {
+ app_config_show_video(current_acc, &acc_cfg);
+ } else if (argc == 4 && strcmp(argv[2], "autorx")==0) {
+ int on = (strcmp(argv[3], "on")==0);
+ acc_cfg.vid_in_auto_show = on;
+ changed = PJ_TRUE;
+ } else if (argc == 4 && strcmp(argv[2], "autotx")==0) {
+ int on = (strcmp(argv[3], "on")==0);
+ acc_cfg.vid_out_auto_transmit = on;
+ changed = PJ_TRUE;
+ } else if (argc == 4 && strcmp(argv[2], "cap")==0) {
+ int dev = atoi(argv[3]);
+ acc_cfg.vid_cap_dev = dev;
+ changed = PJ_TRUE;
+ } else if (argc == 4 && strcmp(argv[2], "rend")==0) {
+ int dev = atoi(argv[3]);
+ acc_cfg.vid_rend_dev = dev;
+ changed = PJ_TRUE;
+ } else {
+ goto on_error;
+ }
+
+ if (changed) {
+ pj_status_t status = pjsua_acc_modify(current_acc, &acc_cfg);
+ if (status != PJ_SUCCESS)
+ PJ_PERROR(1,(THIS_FILE, status, "Error modifying account %d",
+ current_acc));
+ }
+
+ } else if (strcmp(argv[1], "call")==0) {
+ pjsua_call_vid_strm_op_param param;
+ pj_status_t status = PJ_SUCCESS;
+
+ pjsua_call_vid_strm_op_param_default(¶m);
+
+ if (argc == 5 && strcmp(argv[2], "rx")==0) {
+ pjsua_stream_info si;
+ pj_bool_t on = (strcmp(argv[3], "on") == 0);
+
+ param.med_idx = atoi(argv[4]);
+ if (pjsua_call_get_stream_info(current_call, param.med_idx, &si) ||
+ si.type != PJMEDIA_TYPE_VIDEO)
+ {
+ PJ_PERROR(1,(THIS_FILE, PJ_EINVAL, "Invalid stream"));
+ return;
+ }
+
+ if (on) param.dir = (si.info.vid.dir | PJMEDIA_DIR_DECODING);
+ else param.dir = (si.info.vid.dir & PJMEDIA_DIR_ENCODING);
+
+ status = pjsua_call_set_vid_strm(current_call,
+ PJSUA_CALL_VID_STRM_CHANGE_DIR,
+ ¶m);
+ }
+ else if (argc == 5 && strcmp(argv[2], "tx")==0) {
+ pj_bool_t on = (strcmp(argv[3], "on") == 0);
+ pjsua_call_vid_strm_op op = on? PJSUA_CALL_VID_STRM_START_TRANSMIT :
+ PJSUA_CALL_VID_STRM_STOP_TRANSMIT;
+
+ param.med_idx = atoi(argv[4]);
+
+ status = pjsua_call_set_vid_strm(current_call, op, ¶m);
+ }
+ else if (argc == 3 && strcmp(argv[2], "add")==0) {
+ status = pjsua_call_set_vid_strm(current_call,
+ PJSUA_CALL_VID_STRM_ADD, NULL);
+ }
+ else if (argc >= 3 &&
+ (strcmp(argv[2], "disable")==0 || strcmp(argv[2], "enable")==0))
+ {
+ pj_bool_t enable = (strcmp(argv[2], "enable") == 0);
+ pjsua_call_vid_strm_op op = enable? PJSUA_CALL_VID_STRM_CHANGE_DIR :
+ PJSUA_CALL_VID_STRM_REMOVE;
+
+ param.med_idx = argc >= 4? atoi(argv[3]) : -1;
+ param.dir = PJMEDIA_DIR_ENCODING_DECODING;
+ status = pjsua_call_set_vid_strm(current_call, op, ¶m);
+ }
+ else if (argc >= 3 && strcmp(argv[2], "cap")==0) {
+ param.med_idx = argc >= 4? atoi(argv[3]) : -1;
+ param.cap_dev = argc >= 5? atoi(argv[4]) : PJMEDIA_VID_DEFAULT_CAPTURE_DEV;
+ status = pjsua_call_set_vid_strm(current_call,
+ PJSUA_CALL_VID_STRM_CHANGE_CAP_DEV,
+ ¶m);
+ } else
+ goto on_error;
+
+ if (status != PJ_SUCCESS) {
+ PJ_PERROR(1,(THIS_FILE, status, "Error modifying video stream"));
+ }
+
+ } else if (argc >= 3 && strcmp(argv[1], "dev")==0) {
+ if (strcmp(argv[2], "list")==0) {
+ vid_list_devs();
+ } else if (strcmp(argv[2], "refresh")==0) {
+ pjmedia_vid_dev_refresh();
+ } else if (strcmp(argv[2], "prev")==0) {
+ if (argc != 5) {
+ goto on_error;
+ } else {
+ pj_bool_t on = (strcmp(argv[3], "on") == 0);
+ int dev_id = atoi(argv[4]);
+ if (on) {
+ pjsua_vid_preview_param param;
+
+ pjsua_vid_preview_param_default(¶m);
+ param.wnd_flags = PJMEDIA_VID_DEV_WND_BORDER |
+ PJMEDIA_VID_DEV_WND_RESIZABLE;
+ pjsua_vid_preview_start(dev_id, ¶m);
+ arrange_window(pjsua_vid_preview_get_win(dev_id));
+ } else {
+ pjsua_vid_win_id wid;
+ wid = pjsua_vid_preview_get_win(dev_id);
+ if (wid != PJSUA_INVALID_ID) {
+ /* Preview window hiding once it is stopped is
+ * responsibility of app */
+ pjsua_vid_win_set_show(wid, PJ_FALSE);
+ pjsua_vid_preview_stop(dev_id);
+ }
+ }
+ }
+ } else
+ goto on_error;
+ } else if (strcmp(argv[1], "win")==0) {
+ pj_status_t status = PJ_SUCCESS;
+
+ if (argc==3 && strcmp(argv[2], "list")==0) {
+ pjsua_vid_win_id wids[PJSUA_MAX_VID_WINS];
+ unsigned i, cnt = PJ_ARRAY_SIZE(wids);
+
+ pjsua_vid_enum_wins(wids, &cnt);
+
+ PJ_LOG(3,(THIS_FILE, "Found %d video windows:", cnt));
+ PJ_LOG(3,(THIS_FILE, "WID show pos size"));
+ PJ_LOG(3,(THIS_FILE, "------------------------------"));
+ for (i = 0; i < cnt; ++i) {
+ pjsua_vid_win_info wi;
+ pjsua_vid_win_get_info(wids[i], &wi);
+ PJ_LOG(3,(THIS_FILE, "%3d %c (%d,%d) %dx%d",
+ wids[i], (wi.show?'Y':'N'), wi.pos.x, wi.pos.y,
+ wi.size.w, wi.size.h));
+ }
+ } else if (argc==4 && (strcmp(argv[2], "show")==0 ||
+ strcmp(argv[2], "hide")==0))
+ {
+ pj_bool_t show = (strcmp(argv[2], "show")==0);
+ pjsua_vid_win_id wid = atoi(argv[3]);
+ status = pjsua_vid_win_set_show(wid, show);
+ } else if (argc==6 && strcmp(argv[2], "move")==0) {
+ pjsua_vid_win_id wid = atoi(argv[3]);
+ pjmedia_coord pos;
+
+ pos.x = atoi(argv[4]);
+ pos.y = atoi(argv[5]);
+ status = pjsua_vid_win_set_pos(wid, &pos);
+ } else if (argc==6 && strcmp(argv[2], "resize")==0) {
+ pjsua_vid_win_id wid = atoi(argv[3]);
+ pjmedia_rect_size size;
+
+ size.w = atoi(argv[4]);
+ size.h = atoi(argv[5]);
+ status = pjsua_vid_win_set_size(wid, &size);
+ } else if (argc==3 && strcmp(argv[2], "arrange")==0) {
+ arrange_window(PJSUA_INVALID_ID);
+ } else
+ goto on_error;
+
+ if (status != PJ_SUCCESS) {
+ PJ_PERROR(1,(THIS_FILE, status, "Window operation error"));
+ }
+
+ } else if (strcmp(argv[1], "codec")==0) {
+ pjsua_codec_info ci[PJMEDIA_CODEC_MGR_MAX_CODECS];
+ unsigned count = PJ_ARRAY_SIZE(ci);
+ pj_status_t status;
+
+ if (argc==3 && strcmp(argv[2], "list")==0) {
+ status = pjsua_vid_enum_codecs(ci, &count);
+ if (status != PJ_SUCCESS) {
+ PJ_PERROR(1,(THIS_FILE, status, "Error enumerating codecs"));
+ } else {
+ unsigned i;
+ PJ_LOG(3,(THIS_FILE, "Found %d video codecs:", count));
+ PJ_LOG(3,(THIS_FILE, "codec id prio fps bw(kbps) size"));
+ PJ_LOG(3,(THIS_FILE, "------------------------------------------"));
+ for (i=0; i<count; ++i) {
+ pjmedia_vid_codec_param cp;
+ pjmedia_video_format_detail *vfd;
+
+ status = pjsua_vid_codec_get_param(&ci[i].codec_id, &cp);
+ if (status != PJ_SUCCESS)
+ continue;
+
+ vfd = pjmedia_format_get_video_format_detail(&cp.enc_fmt,
+ PJ_TRUE);
+ PJ_LOG(3,(THIS_FILE, "%.*s%.*s %3d %7.2f %4d/%4d %dx%d",
+ (int)ci[i].codec_id.slen, ci[i].codec_id.ptr,
+ 13-(int)ci[i].codec_id.slen, " ",
+ ci[i].priority,
+ (vfd->fps.num*1.0/vfd->fps.denum),
+ vfd->avg_bps/1000, vfd->max_bps/1000,
+ vfd->size.w, vfd->size.h));
+ }
+ }
+ } else if (argc==5 && strcmp(argv[2], "prio")==0) {
+ pj_str_t cid;
+ int prio;
+ cid = pj_str(argv[3]);
+ prio = atoi(argv[4]);
+ status = pjsua_vid_codec_set_priority(&cid, (pj_uint8_t)prio);
+ if (status != PJ_SUCCESS)
+ PJ_PERROR(1,(THIS_FILE, status, "Set codec priority error"));
+ } else if (argc==6 && strcmp(argv[2], "fps")==0) {
+ pjmedia_vid_codec_param cp;
+ pj_str_t cid;
+ int M, N;
+ cid = pj_str(argv[3]);
+ M = atoi(argv[4]);
+ N = atoi(argv[5]);
+ status = pjsua_vid_codec_get_param(&cid, &cp);
+ if (status == PJ_SUCCESS) {
+ cp.enc_fmt.det.vid.fps.num = M;
+ cp.enc_fmt.det.vid.fps.denum = N;
+ status = pjsua_vid_codec_set_param(&cid, &cp);
+ }
+ if (status != PJ_SUCCESS)
+ PJ_PERROR(1,(THIS_FILE, status, "Set codec framerate error"));
+ } else if (argc==6 && strcmp(argv[2], "bw")==0) {
+ pjmedia_vid_codec_param cp;
+ pj_str_t cid;
+ int M, N;
+ cid = pj_str(argv[3]);
+ M = atoi(argv[4]);
+ N = atoi(argv[5]);
+ status = pjsua_vid_codec_get_param(&cid, &cp);
+ if (status == PJ_SUCCESS) {
+ cp.enc_fmt.det.vid.avg_bps = M * 1000;
+ cp.enc_fmt.det.vid.max_bps = N * 1000;
+ status = pjsua_vid_codec_set_param(&cid, &cp);
+ }
+ if (status != PJ_SUCCESS)
+ PJ_PERROR(1,(THIS_FILE, status, "Set codec bitrate error"));
+ } else if (argc==6 && strcmp(argv[2], "size")==0) {
+ pjmedia_vid_codec_param cp;
+ pj_str_t cid;
+ int M, N;
+ cid = pj_str(argv[3]);
+ M = atoi(argv[4]);
+ N = atoi(argv[5]);
+ status = pjsua_vid_codec_get_param(&cid, &cp);
+ if (status == PJ_SUCCESS) {
+ cp.enc_fmt.det.vid.size.w = M;
+ cp.enc_fmt.det.vid.size.h = N;
+ status = pjsua_vid_codec_set_param(&cid, &cp);
+ }
+ if (status != PJ_SUCCESS)
+ PJ_PERROR(1,(THIS_FILE, status, "Set codec size error"));
+ } else
+ goto on_error;
+ } else
+ goto on_error;
+
+ return;
+
+on_error:
+ PJ_LOG(1,(THIS_FILE, "Invalid command, use 'vid help'"));
+}
+
+#endif /* PJSUA_HAS_VIDEO */
+
+/** UI Command **/
+static void ui_make_new_call()
+{
+ char buf[128];
+ pjsua_msg_data msg_data;
+ input_result result;
+ pj_str_t tmp;
+
+ printf("(You currently have %d calls)\n", pjsua_call_get_count());
+
+ ui_input_url("Make call", buf, sizeof(buf), &result);
+ if (result.nb_result != PJSUA_APP_NO_NB) {
+
+ if (result.nb_result == -1 || result.nb_result == 0) {
+ puts("You can't do that with make call!");
+ return;
+ } else {
+ pjsua_buddy_info binfo;
+ pjsua_buddy_get_info(result.nb_result-1, &binfo);
+ tmp.ptr = buf;
+ pj_strncpy(&tmp, &binfo.uri, sizeof(buf));
+ }
+
+ } else if (result.uri_result) {
+ tmp = pj_str(result.uri_result);
+ } else {
+ tmp.slen = 0;
+ }
+
+ pjsua_msg_data_init(&msg_data);
+ TEST_MULTIPART(&msg_data);
+ pjsua_call_make_call(current_acc, &tmp, &call_opt, NULL,
+ &msg_data, ¤t_call);
+}
+
+static void ui_make_multi_call()
+{
+ char menuin[32];
+ int count;
+ char buf[128];
+ input_result result;
+ pj_str_t tmp;
+ int i;
+
+ printf("(You currently have %d calls)\n", pjsua_call_get_count());
+
+ if (!simple_input("Number of calls", menuin, sizeof(menuin)))
+ return;
+
+ count = my_atoi(menuin);
+ if (count < 1)
+ return;
+
+ ui_input_url("Make call", buf, sizeof(buf), &result);
+ if (result.nb_result != PJSUA_APP_NO_NB) {
+ pjsua_buddy_info binfo;
+ if (result.nb_result == -1 || result.nb_result == 0) {
+ puts("You can't do that with make call!");
+ return;
+ }
+ pjsua_buddy_get_info(result.nb_result-1, &binfo);
+ tmp.ptr = buf;
+ pj_strncpy(&tmp, &binfo.uri, sizeof(buf));
+ } else {
+ tmp = pj_str(result.uri_result);
+ }
+
+ for (i=0; i<my_atoi(menuin); ++i) {
+ pj_status_t status;
+
+ status = pjsua_call_make_call(current_acc, &tmp, &call_opt, NULL,
+ NULL, NULL);
+ if (status != PJ_SUCCESS)
+ break;
+ }
+}
+
+static void ui_detect_nat_type()
+{
+ int i = pjsua_detect_nat_type();
+ if (i != PJ_SUCCESS)
+ pjsua_perror(THIS_FILE, "Error", i);
+}
+
+static void ui_send_instant_message()
+{
+ char *uri = NULL;
+ /* i is for call index to send message, if any */
+ int i = -1;
+ input_result result;
+ char buf[128];
+ char text[128];
+ pj_str_t tmp;
+
+ /* Input destination. */
+ ui_input_url("Send IM to", buf, sizeof(buf), &result);
+ if (result.nb_result != PJSUA_APP_NO_NB) {
+
+ if (result.nb_result == -1) {
+ puts("You can't send broadcast IM like that!");
+ return;
+
+ } else if (result.nb_result == 0) {
+ i = current_call;
+ } else {
+ pjsua_buddy_info binfo;
+ pjsua_buddy_get_info(result.nb_result-1, &binfo);
+ tmp.ptr = buf;
+ pj_strncpy_with_null(&tmp, &binfo.uri, sizeof(buf));
+ uri = buf;
+ }
+
+ } else if (result.uri_result) {
+ uri = result.uri_result;
+ }
+
+
+ /* Send typing indication. */
+ if (i != -1)
+ pjsua_call_send_typing_ind(i, PJ_TRUE, NULL);
+ else {
+ pj_str_t tmp_uri = pj_str(uri);
+ pjsua_im_typing(current_acc, &tmp_uri, PJ_TRUE, NULL);
+ }
+
+ /* Input the IM . */
+ if (!simple_input("Message", text, sizeof(text))) {
+ /*
+ * Cancelled.
+ * Send typing notification too, saying we're not typing.
+ */
+ if (i != -1)
+ pjsua_call_send_typing_ind(i, PJ_FALSE, NULL);
+ else {
+ pj_str_t tmp_uri = pj_str(uri);
+ pjsua_im_typing(current_acc, &tmp_uri, PJ_FALSE, NULL);
+ }
+ return;
+ }
+
+ tmp = pj_str(text);
+
+ /* Send the IM */
+ if (i != -1)
+ pjsua_call_send_im(i, NULL, &tmp, NULL, NULL);
+ else {
+ pj_str_t tmp_uri = pj_str(uri);
+ pjsua_im_send(current_acc, &tmp_uri, NULL, &tmp, NULL, NULL);
+ }
+}
+
+static void ui_answer_call()
+{
+ pjsua_call_info call_info;
+ char buf[128];
+ pjsua_msg_data msg_data;
+
+ if (current_call != -1) {
+ pjsua_call_get_info(current_call, &call_info);
+ } else {
+ /* Make compiler happy */
+ call_info.role = PJSIP_ROLE_UAC;
+ call_info.state = PJSIP_INV_STATE_DISCONNECTED;
+ }
+
+ if (current_call == -1 ||
+ call_info.role != PJSIP_ROLE_UAS ||
+ call_info.state >= PJSIP_INV_STATE_CONNECTING)
+ {
+ puts("No pending incoming call");
+ fflush(stdout);
+ return;
+
+ } else {
+ int st_code;
+ char contact[120];
+ pj_str_t hname = { "Contact", 7 };
+ pj_str_t hvalue;
+ pjsip_generic_string_hdr hcontact;
+
+ if (!simple_input("Answer with code (100-699)", buf, sizeof(buf)))
+ return;
+
+ st_code = my_atoi(buf);
+ if (st_code < 100)
+ return;
+
+ pjsua_msg_data_init(&msg_data);
+
+ if (st_code/100 == 3) {
+ if (!simple_input("Enter URL to be put in Contact",
+ contact, sizeof(contact)))
+ return;
+ hvalue = pj_str(contact);
+ pjsip_generic_string_hdr_init2(&hcontact, &hname, &hvalue);
+
+ pj_list_push_back(&msg_data.hdr_list, &hcontact);
+ }
+
+ /*
+ * Must check again!
+ * Call may have been disconnected while we're waiting for
+ * keyboard input.
+ */
+ if (current_call == -1) {
+ puts("Call has been disconnected");
+ fflush(stdout);
+ return;
+ }
+
+ pjsua_call_answer2(current_call, &call_opt, st_code, NULL, &msg_data);
+ }
+}
+
+static void ui_hangup_call(char menuin[])
+{
+ if (current_call == -1) {
+ puts("No current call");
+ fflush(stdout);
+ return;
+
+ } else if (menuin[1] == 'a') {
+ /* Hangup all calls */
+ pjsua_call_hangup_all();
+ } else {
+ /* Hangup current calls */
+ pjsua_call_hangup(current_call, 0, NULL, NULL);
+ }
+}
+
+static void ui_cycle_dialog(char menuin[])
+{
+ if (menuin[0] == ']') {
+ find_next_call();
+
+ } else {
+ find_prev_call();
+ }
+
+ if (current_call != -1) {
+ pjsua_call_info call_info;
+
+ pjsua_call_get_info(current_call, &call_info);
+ PJ_LOG(3,(THIS_FILE,"Current dialog: %.*s",
+ (int)call_info.remote_info.slen,
+ call_info.remote_info.ptr));
+
+ } else {
+ PJ_LOG(3,(THIS_FILE,"No current dialog"));
+ }
+}
+
+static void ui_cycle_account()
+{
+ int i;
+ char buf[128];
+
+ if (!simple_input("Enter account ID to select", buf, sizeof(buf)))
+ return;
+
+ i = my_atoi(buf);
+ if (pjsua_acc_is_valid(i)) {
+ pjsua_acc_set_default(i);
+ PJ_LOG(3,(THIS_FILE, "Current account changed to %d", i));
+ } else {
+ PJ_LOG(3,(THIS_FILE, "Invalid account id %d", i));
+ }
+}
+
+static void ui_add_buddy()
+{
+ char buf[128];
+ pjsua_buddy_config buddy_cfg;
+ pjsua_buddy_id buddy_id;
+ pj_status_t status;
+
+ if (!simple_input("Enter buddy's URI:", buf, sizeof(buf)))
+ return;
+
+ if (pjsua_verify_url(buf) != PJ_SUCCESS) {
+ printf("Invalid URI '%s'\n", buf);
+ return;
+ }
+
+ pj_bzero(&buddy_cfg, sizeof(pjsua_buddy_config));
+
+ buddy_cfg.uri = pj_str(buf);
+ buddy_cfg.subscribe = PJ_TRUE;
+
+ status = pjsua_buddy_add(&buddy_cfg, &buddy_id);
+ if (status == PJ_SUCCESS) {
+ printf("New buddy '%s' added at index %d\n",
+ buf, buddy_id+1);
+ }
+}
+
+static void ui_add_account(pjsua_transport_config *rtp_cfg)
+{
+ char id[80], registrar[80], realm[80], uname[80], passwd[30];
+ pjsua_acc_config acc_cfg;
+ pj_status_t status;
+
+ if (!simple_input("Your SIP URL:", id, sizeof(id)))
+ return;
+ if (!simple_input("URL of the registrar:", registrar, sizeof(registrar)))
+ return;
+ if (!simple_input("Auth Realm:", realm, sizeof(realm)))
+ return;
+ if (!simple_input("Auth Username:", uname, sizeof(uname)))
+ return;
+ if (!simple_input("Auth Password:", passwd, sizeof(passwd)))
+ return;
+
+ pjsua_acc_config_default(&acc_cfg);
+ acc_cfg.id = pj_str(id);
+ acc_cfg.reg_uri = pj_str(registrar);
+ acc_cfg.cred_count = 1;
+ acc_cfg.cred_info[0].scheme = pj_str("Digest");
+ acc_cfg.cred_info[0].realm = pj_str(realm);
+ acc_cfg.cred_info[0].username = pj_str(uname);
+ acc_cfg.cred_info[0].data_type = 0;
+ acc_cfg.cred_info[0].data = pj_str(passwd);
+
+ acc_cfg.rtp_cfg = *rtp_cfg;
+ app_config_init_video(&acc_cfg);
+
+ status = pjsua_acc_add(&acc_cfg, PJ_TRUE, NULL);
+ if (status != PJ_SUCCESS) {
+ pjsua_perror(THIS_FILE, "Error adding new account", status);
+ }
+}
+
+static void ui_delete_buddy()
+{
+ char buf[128];
+ int i;
+
+ if (!simple_input("Enter buddy ID to delete", buf, sizeof(buf)))
+ return;
+
+ i = my_atoi(buf) - 1;
+
+ if (!pjsua_buddy_is_valid(i)) {
+ printf("Invalid buddy id %d\n", i);
+ } else {
+ pjsua_buddy_del(i);
+ printf("Buddy %d deleted\n", i);
+ }
+}
+
+static void ui_delete_account()
+{
+ char buf[128];
+ int i;
+
+ if (!simple_input("Enter account ID to delete", buf, sizeof(buf)))
+ return;
+
+ i = my_atoi(buf);
+
+ if (!pjsua_acc_is_valid(i)) {
+ printf("Invalid account id %d\n", i);
+ } else {
+ pjsua_acc_del(i);
+ printf("Account %d deleted\n", i);
+ }
+}
+
+static void ui_call_hold()
+{
+ if (current_call != -1) {
+ pjsua_call_set_hold(current_call, NULL);
+ } else {
+ PJ_LOG(3,(THIS_FILE, "No current call"));
+ }
+}
+
+static void ui_call_reinvite()
+{
+ call_opt.flag |= PJSUA_CALL_UNHOLD;
+ pjsua_call_reinvite2(current_call, &call_opt, NULL);
+}
+
+static void ui_send_update()
+{
+ if (current_call != -1) {
+ pjsua_call_update2(current_call, &call_opt, NULL);
+ } else {
+ PJ_LOG(3,(THIS_FILE, "No current call"));
+ }
+}
+
+/*
+ * Change codec priorities.
+ */
+static void ui_manage_codec_prio()
+{
+ pjsua_codec_info c[32];
+ unsigned i, count = PJ_ARRAY_SIZE(c);
+ char input[32];
+ char *codec, *prio;
+ pj_str_t id;
+ int new_prio;
+ pj_status_t status;
+
+ printf("List of audio codecs:\n");
+ pjsua_enum_codecs(c, &count);
+ for (i=0; i<count; ++i) {
+ printf(" %d\t%.*s\n", c[i].priority, (int)c[i].codec_id.slen,
+ c[i].codec_id.ptr);
+ }
+
+#if PJSUA_HAS_VIDEO
+ puts("");
+ printf("List of video codecs:\n");
+ pjsua_vid_enum_codecs(c, &count);
+ for (i=0; i<count; ++i) {
+ printf(" %d\t%.*s%s%.*s\n", c[i].priority,
+ (int)c[i].codec_id.slen,
+ c[i].codec_id.ptr,
+ c[i].desc.slen? " - ":"",
+ (int)c[i].desc.slen,
+ c[i].desc.ptr);
+ }
+#endif
+
+ puts("");
+ puts("Enter codec id and its new priority (e.g. \"speex/16000 200\", "
+ """\"H263 200\"),");
+ puts("or empty to cancel.");
+
+ printf("Codec name (\"*\" for all) and priority: ");
+ if (fgets(input, sizeof(input), stdin) == NULL)
+ return;
+ if (input[0]=='\r' || input[0]=='\n') {
+ puts("Done");
+ return;
+ }
+
+ codec = strtok(input, " \t\r\n");
+ prio = strtok(NULL, " \r\n");
+
+ if (!codec || !prio) {
+ puts("Invalid input");
+ return;
+ }
+
+ new_prio = atoi(prio);
+ if (new_prio < 0)
+ new_prio = 0;
+ else if (new_prio > PJMEDIA_CODEC_PRIO_HIGHEST)
+ new_prio = PJMEDIA_CODEC_PRIO_HIGHEST;
+
+ status = pjsua_codec_set_priority(pj_cstr(&id, codec),
+ (pj_uint8_t)new_prio);
+#if PJSUA_HAS_VIDEO
+ if (status != PJ_SUCCESS) {
+ status = pjsua_vid_codec_set_priority(pj_cstr(&id, codec),
+ (pj_uint8_t)new_prio);
+ }
+#endif
+ if (status != PJ_SUCCESS)
+ pjsua_perror(THIS_FILE, "Error setting codec priority", status);
+}
+
+static void ui_call_transfer(pj_bool_t no_refersub)
+{
+ if (current_call == -1) {
+ PJ_LOG(3,(THIS_FILE, "No current call"));
+ } else {
+ int call = current_call;
+ char buf[128];
+ pjsip_generic_string_hdr refer_sub;
+ pj_str_t STR_REFER_SUB = { "Refer-Sub", 9 };
+ pj_str_t STR_FALSE = { "false", 5 };
+ pjsua_call_info ci;
+ input_result result;
+ pjsua_msg_data msg_data;
+
+ pjsua_call_get_info(current_call, &ci);
+ printf("Transfering current call [%d] %.*s\n", current_call,
+ (int)ci.remote_info.slen, ci.remote_info.ptr);
+
+ ui_input_url("Transfer to URL", buf, sizeof(buf), &result);
+
+ /* Check if call is still there. */
+
+ if (call != current_call) {
+ puts("Call has been disconnected");
+ return;
+ }
+
+ pjsua_msg_data_init(&msg_data);
+ if (no_refersub) {
+ /* Add Refer-Sub: false in outgoing REFER request */
+ pjsip_generic_string_hdr_init2(&refer_sub, &STR_REFER_SUB,
+ &STR_FALSE);
+ pj_list_push_back(&msg_data.hdr_list, &refer_sub);
+ }
+ if (result.nb_result != PJSUA_APP_NO_NB) {
+ if (result.nb_result == -1 || result.nb_result == 0)
+ puts("You can't do that with transfer call!");
+ else {
+ pjsua_buddy_info binfo;
+ pjsua_buddy_get_info(result.nb_result-1, &binfo);
+ pjsua_call_xfer( current_call, &binfo.uri, &msg_data);
+ }
+
+ } else if (result.uri_result) {
+ pj_str_t tmp;
+ tmp = pj_str(result.uri_result);
+ pjsua_call_xfer( current_call, &tmp, &msg_data);
+ }
+ }
+}
+
+static void ui_call_transfer_replaces(pj_bool_t no_refersub)
+{
+ if (current_call == -1) {
+ PJ_LOG(3,(THIS_FILE, "No current call"));
+ } else {
+ int call = current_call;
+ int dst_call;
+ pjsip_generic_string_hdr refer_sub;
+ pj_str_t STR_REFER_SUB = { "Refer-Sub", 9 };
+ pj_str_t STR_FALSE = { "false", 5 };
+ pjsua_call_id ids[PJSUA_MAX_CALLS];
+ pjsua_call_info ci;
+ pjsua_msg_data msg_data;
+ char buf[128];
+ unsigned i, count;
+
+ count = PJ_ARRAY_SIZE(ids);
+ pjsua_enum_calls(ids, &count);
+
+ if (count <= 1) {
+ puts("There are no other calls");
+ return;
+ }
+
+ pjsua_call_get_info(current_call, &ci);
+ printf("Transfer call [%d] %.*s to one of the following:\n",
+ current_call,
+ (int)ci.remote_info.slen, ci.remote_info.ptr);
+
+ for (i=0; i<count; ++i) {
+ pjsua_call_info call_info;
+
+ if (ids[i] == call)
+ return;
+
+ pjsua_call_get_info(ids[i], &call_info);
+ printf("%d %.*s [%.*s]\n",
+ ids[i],
+ (int)call_info.remote_info.slen,
+ call_info.remote_info.ptr,
+ (int)call_info.state_text.slen,
+ call_info.state_text.ptr);
+ }
+
+ if (!simple_input("Enter call number to be replaced", buf, sizeof(buf)))
+ return;
+
+ dst_call = my_atoi(buf);
+
+ /* Check if call is still there. */
+
+ if (call != current_call) {
+ puts("Call has been disconnected");
+ return;
+ }
+
+ /* Check that destination call is valid. */
+ if (dst_call == call) {
+ puts("Destination call number must not be the same "
+ "as the call being transfered");
+ return;
+ }
+ if (dst_call >= PJSUA_MAX_CALLS) {
+ puts("Invalid destination call number");
+ return;
+ }
+ if (!pjsua_call_is_active(dst_call)) {
+ puts("Invalid destination call number");
+ return;
+ }
+
+ pjsua_msg_data_init(&msg_data);
+ if (no_refersub) {
+ /* Add Refer-Sub: false in outgoing REFER request */
+ pjsip_generic_string_hdr_init2(&refer_sub, &STR_REFER_SUB,
+ &STR_FALSE);
+ pj_list_push_back(&msg_data.hdr_list, &refer_sub);
+ }
+
+ pjsua_call_xfer_replaces(call, dst_call,
+ PJSUA_XFER_NO_REQUIRE_REPLACES,
+ &msg_data);
+ }
+}
+
+static void ui_send_dtmf_2833()
+{
+ if (current_call == -1) {
+ PJ_LOG(3,(THIS_FILE, "No current call"));
+ } else if (!pjsua_call_has_media(current_call)) {
+ PJ_LOG(3,(THIS_FILE, "Media is not established yet!"));
+ } else {
+ pj_str_t digits;
+ int call = current_call;
+ pj_status_t status;
+ char buf[128];
+
+ if (!simple_input("DTMF strings to send (0-9*#A-B)", buf,
+ sizeof(buf)))
+ {
+ return;
+ }
+
+ if (call != current_call) {
+ puts("Call has been disconnected");
+ return;
+ }
+
+ digits = pj_str(buf);
+ status = pjsua_call_dial_dtmf(current_call, &digits);
+ if (status != PJ_SUCCESS) {
+ pjsua_perror(THIS_FILE, "Unable to send DTMF", status);
+ } else {
+ puts("DTMF digits enqueued for transmission");
+ }
+ }
+}
+
+static void ui_send_dtmf_info()
+{
+ if (current_call == -1) {
+ PJ_LOG(3,(THIS_FILE, "No current call"));
+ } else {
+ const pj_str_t SIP_INFO = pj_str("INFO");
+ pj_str_t digits;
+ int call = current_call;
+ int i;
+ pj_status_t status;
+ char buf[128];
+
+ if (!simple_input("DTMF strings to send (0-9*#A-B)", buf,
+ sizeof(buf)))
+ {
+ return;
+ }
+
+ if (call != current_call) {
+ puts("Call has been disconnected");
+ return;
+ }
+
+ digits = pj_str(buf);
+ for (i=0; i<digits.slen; ++i) {
+ char body[80];
+ pjsua_msg_data msg_data;
+
+ pjsua_msg_data_init(&msg_data);
+ msg_data.content_type = pj_str("application/dtmf-relay");
+
+ pj_ansi_snprintf(body, sizeof(body),
+ "Signal=%c\r\n"
+ "Duration=160",
+ buf[i]);
+ msg_data.msg_body = pj_str(body);
+
+ status = pjsua_call_send_request(current_call, &SIP_INFO,
+ &msg_data);
+ if (status != PJ_SUCCESS) {
+ return;
+ }
+ }
+ }
+}
+
+static void ui_send_arbitrary_request()
+{
+ char text[128];
+ char buf[128];
+ char *uri;
+ input_result result;
+ pj_str_t tmp;
+
+ if (pjsua_acc_get_count() == 0) {
+ puts("Sorry, need at least one account configured");
+ return;
+ }
+
+ puts("Send arbitrary request to remote host");
+
+ /* Input METHOD */
+ if (!simple_input("Request method:",text,sizeof(text)))
+ return;
+
+ /* Input destination URI */
+ uri = NULL;
+ ui_input_url("Destination URI", buf, sizeof(buf), &result);
+ if (result.nb_result != PJSUA_APP_NO_NB) {
+
+ if (result.nb_result == -1) {
+ puts("Sorry you can't do that!");
+ return;
+ } else if (result.nb_result == 0) {
+ uri = NULL;
+ if (current_call == PJSUA_INVALID_ID) {
+ puts("No current call");
+ return;
+ }
+ } else {
+ pjsua_buddy_info binfo;
+ pjsua_buddy_get_info(result.nb_result-1, &binfo);
+ tmp.ptr = buf;
+ pj_strncpy_with_null(&tmp, &binfo.uri, sizeof(buf));
+ uri = buf;
+ }
+
+ } else if (result.uri_result) {
+ uri = result.uri_result;
+ } else {
+ return;
+ }
+
+ if (uri) {
+ tmp = pj_str(uri);
+ send_request(text, &tmp);
+ } else {
+ /* If you send call control request using this method
+ * (such requests includes BYE, CANCEL, etc.), it will
+ * not go well with the call state, so don't do it
+ * unless it's for testing.
+ */
+ pj_str_t method = pj_str(text);
+ pjsua_call_send_request(current_call, &method, NULL);
+ }
+}
+
+static void ui_echo(char menuin[])
+{
+ if (pj_ansi_strnicmp(menuin, "echo", 4)==0) {
+ pj_str_t tmp;
+
+ tmp.ptr = menuin+5;
+ tmp.slen = pj_ansi_strlen(menuin)-6;
+
+ if (tmp.slen < 1) {
+ puts("Usage: echo [0|1]");
+ return;
+ }
+ cmd_echo = *tmp.ptr != '0' || tmp.slen!=1;
+ }
+}
+
+static void ui_sleep(char menuin[])
+{
+ if (pj_ansi_strnicmp(menuin, "sleep", 5)==0) {
+ pj_str_t tmp;
+ int delay;
+
+ tmp.ptr = menuin+6;
+ tmp.slen = pj_ansi_strlen(menuin)-7;
+
+ if (tmp.slen < 1) {
+ puts("Usage: sleep MSEC");
+ return;
+ }
+
+ delay = pj_strtoul(&tmp);
+ if (delay < 0) delay = 0;
+ pj_thread_sleep(delay);
+ }
+}
+
+static void ui_subscribe(char menuin[])
+{
+ char buf[128];
+ input_result result;
+
+ ui_input_url("(un)Subscribe presence of", buf, sizeof(buf), &result);
+ if (result.nb_result != PJSUA_APP_NO_NB) {
+ if (result.nb_result == -1) {
+ int i, count;
+ count = pjsua_get_buddy_count();
+ for (i=0; i<count; ++i)
+ pjsua_buddy_subscribe_pres(i, menuin[0]=='s');
+ } else if (result.nb_result == 0) {
+ puts("Sorry, can only subscribe to buddy's presence, "
+ "not from existing call");
+ } else {
+ pjsua_buddy_subscribe_pres(result.nb_result-1, (menuin[0]=='s'));
+ }
+
+ } else if (result.uri_result) {
+ puts("Sorry, can only subscribe to buddy's presence, "
+ "not arbitrary URL (for now)");
+ }
+}
+
+static void ui_register(char menuin[])
+{
+ switch (menuin[1]) {
+ case 'r':
+ /*
+ * Re-Register.
+ */
+ pjsua_acc_set_registration(current_acc, PJ_TRUE);
+ break;
+ case 'u':
+ /*
+ * Unregister
+ */
+ pjsua_acc_set_registration(current_acc, PJ_FALSE);
+ break;
+ }
+}
+
+static void ui_toggle_state()
+{
+ pjsua_acc_info acc_info;
+
+ pjsua_acc_get_info(current_acc, &acc_info);
+ acc_info.online_status = !acc_info.online_status;
+ pjsua_acc_set_online_status(current_acc, acc_info.online_status);
+ printf("Setting %s online status to %s\n",
+ acc_info.acc_uri.ptr,
+ (acc_info.online_status?"online":"offline"));
+}
+
+/*
+ * Change extended online status.
+ */
+static void ui_change_online_status()
+{
+ char menuin[32];
+ pj_bool_t online_status;
+ pjrpid_element elem;
+ int i, choice;
+
+ enum {
+ AVAILABLE, BUSY, OTP, IDLE, AWAY, BRB, OFFLINE, OPT_MAX
+ };
+
+ struct opt {
+ int id;
+ char *name;
+ } opts[] = {
+ { AVAILABLE, "Available" },
+ { BUSY, "Busy"},
+ { OTP, "On the phone"},
+ { IDLE, "Idle"},
+ { AWAY, "Away"},
+ { BRB, "Be right back"},
+ { OFFLINE, "Offline"}
+ };
+
+ printf("\n"
+ "Choices:\n");
+ for (i=0; i<PJ_ARRAY_SIZE(opts); ++i) {
+ printf(" %d %s\n", opts[i].id+1, opts[i].name);
+ }
+
+ if (!simple_input("Select status", menuin, sizeof(menuin)))
+ return;
+
+ choice = atoi(menuin) - 1;
+ if (choice < 0 || choice >= OPT_MAX) {
+ puts("Invalid selection");
+ return;
+ }
+
+ pj_bzero(&elem, sizeof(elem));
+ elem.type = PJRPID_ELEMENT_TYPE_PERSON;
+
+ online_status = PJ_TRUE;
+
+ switch (choice) {
+ case AVAILABLE:
+ break;
+ case BUSY:
+ elem.activity = PJRPID_ACTIVITY_BUSY;
+ elem.note = pj_str("Busy");
+ break;
+ case OTP:
+ elem.activity = PJRPID_ACTIVITY_BUSY;
+ elem.note = pj_str("On the phone");
+ break;
+ case IDLE:
+ elem.activity = PJRPID_ACTIVITY_UNKNOWN;
+ elem.note = pj_str("Idle");
+ break;
+ case AWAY:
+ elem.activity = PJRPID_ACTIVITY_AWAY;
+ elem.note = pj_str("Away");
+ break;
+ case BRB:
+ elem.activity = PJRPID_ACTIVITY_UNKNOWN;
+ elem.note = pj_str("Be right back");
+ break;
+ case OFFLINE:
+ online_status = PJ_FALSE;
+ break;
+ }
+
+ pjsua_acc_set_online_status2(current_acc, online_status, &elem);
+}
+
+/*
+ * List the ports in conference bridge
+ */
+static void ui_conf_list()
+{
+ unsigned i, count;
+ pjsua_conf_port_id id[PJSUA_MAX_CALLS];
+
+ printf("Conference ports:\n");
+
+ count = PJ_ARRAY_SIZE(id);
+ pjsua_enum_conf_ports(id, &count);
+
+ for (i=0; i<count; ++i) {
+ char txlist[PJSUA_MAX_CALLS*4+10];
+ unsigned j;
+ pjsua_conf_port_info info;
+
+ pjsua_conf_get_port_info(id[i], &info);
+
+ txlist[0] = '\0';
+ for (j=0; j<info.listener_cnt; ++j) {
+ char s[10];
+ pj_ansi_snprintf(s, sizeof(s), "#%d ", info.listeners[j]);
+ pj_ansi_strcat(txlist, s);
+ }
+ printf("Port #%02d[%2dKHz/%dms/%d] %20.*s transmitting to: %s\n",
+ info.slot_id,
+ info.clock_rate/1000,
+ info.samples_per_frame*1000/info.channel_count/info.clock_rate,
+ info.channel_count,
+ (int)info.name.slen,
+ info.name.ptr,
+ txlist);
+
+ }
+ puts("");
+}
+
+static void ui_conf_connect(char menuin[])
+{
+ char tmp[10], src_port[10], dst_port[10];
+ pj_status_t status;
+ int cnt;
+ const char *src_title, *dst_title;
+
+ cnt = sscanf(menuin, "%s %s %s", tmp, src_port, dst_port);
+
+ if (cnt != 3) {
+ ui_conf_list();
+
+ src_title = (menuin[1]=='c'? "Connect src port #":
+ "Disconnect src port #");
+ dst_title = (menuin[1]=='c'? "To dst port #":"From dst port #");
+
+ if (!simple_input(src_title, src_port, sizeof(src_port)))
+ return;
+
+ if (!simple_input(dst_title, dst_port, sizeof(dst_port)))
+ return;
+ }
+
+ if (menuin[1]=='c') {
+ status = pjsua_conf_connect(my_atoi(src_port), my_atoi(dst_port));
+ } else {
+ status = pjsua_conf_disconnect(my_atoi(src_port), my_atoi(dst_port));
+ }
+ if (status == PJ_SUCCESS) {
+ puts("Success");
+ } else {
+ puts("ERROR!!");
+ }
+}
+
+static void ui_adjust_volume()
+{
+ char buf[128];
+ char text[128];
+ sprintf(buf, "Adjust mic level: [%4.1fx] ", app_config.mic_level);
+ if (simple_input(buf,text,sizeof(text))) {
+ char *err;
+ app_config.mic_level = (float)strtod(text, &err);
+ pjsua_conf_adjust_rx_level(0, app_config.mic_level);
+ }
+ sprintf(buf, "Adjust speaker level: [%4.1fx] ", app_config.speaker_level);
+ if (simple_input(buf,text,sizeof(text))) {
+ char *err;
+ app_config.speaker_level = (float)strtod(text, &err);
+ pjsua_conf_adjust_tx_level(0, app_config.speaker_level);
+ }
+}
+
+static void ui_dump_call_quality()
+{
+ if (current_call != PJSUA_INVALID_ID) {
+ log_call_dump(current_call);
+ } else {
+ PJ_LOG(3,(THIS_FILE, "No current call"));
+ }
+}
+
+static void ui_dump_configuration()
+{
+ char settings[2000];
+ int len;
+
+ len = write_settings(&app_config, settings, sizeof(settings));
+ if (len < 1)
+ PJ_LOG(1,(THIS_FILE, "Error: not enough buffer"));
+ else
+ PJ_LOG(3,(THIS_FILE, "Dumping configuration (%d bytes):\n%s\n",
+ len, settings));
+}
+
+static void ui_write_settings()
+{
+ char settings[2000];
+ int len;
+ char buf[128];
+
+ len = write_settings(&app_config, settings, sizeof(settings));
+ if (len < 1)
+ PJ_LOG(1,(THIS_FILE, "Error: not enough buffer"));
+ else {
+ pj_oshandle_t fd;
+ pj_status_t status;
+
+ status = pj_file_open(app_config.pool, buf, PJ_O_WRONLY, &fd);
+ if (status != PJ_SUCCESS) {
+ pjsua_perror(THIS_FILE, "Unable to open file", status);
+ } else {
+ pj_ssize_t size = len;
+ pj_file_write(fd, settings, &size);
+ pj_file_close(fd);
+
+ printf("Settings successfully written to '%s'\n", buf);
+ }
+ }
+}
+
+/*
+ * Dump application states.
+ */
+static void ui_app_dump(pj_bool_t detail)
+{
+ pjsua_dump(detail);
+}
+
+static void ui_call_redirect(char menuin[])
+{
+ if (current_call == PJSUA_INVALID_ID) {
+ PJ_LOG(3,(THIS_FILE, "No current call"));
+ } else {
+ if (!pjsua_call_is_active(current_call)) {
+ PJ_LOG(1,(THIS_FILE, "Call %d has gone", current_call));
+ } else if (menuin[1] == 'a') {
+ pjsua_call_process_redirect(current_call,
+ PJSIP_REDIRECT_ACCEPT_REPLACE);
+ } else if (menuin[1] == 'A') {
+ pjsua_call_process_redirect(current_call,
+ PJSIP_REDIRECT_ACCEPT);
+ } else if (menuin[1] == 'r') {
+ pjsua_call_process_redirect(current_call,
+ PJSIP_REDIRECT_REJECT);
+ } else {
+ pjsua_call_process_redirect(current_call,
+ PJSIP_REDIRECT_STOP);
+ }
+ }
+}
+
+/*
+ * Main "user interface" loop.
+ */
+void legacy_main()
+{
+ char menuin[80];
+ char buf[128];
+
+ keystroke_help();
+
+ for (;;) {
+
+ printf(">>> ");
+ fflush(stdout);
+
+ if (fgets(menuin, sizeof(menuin), stdin) == NULL) {
+ /*
+ * Be friendly to users who redirect commands into
+ * program, when file ends, resume with kbd.
+ * If exit is desired end script with q for quit
+ */
+ /* Reopen stdin/stdout/stderr to /dev/console */
+#if ((defined(PJ_WIN32) && PJ_WIN32!=0) || \
+ (defined(PJ_WIN64) && PJ_WIN64!=0)) && \
+ (!defined(PJ_WIN32_WINCE) || PJ_WIN32_WINCE==0)
+ if (freopen ("CONIN$", "r", stdin) == NULL) {
+#else
+ if (1) {
+#endif
+ puts("Cannot switch back to console from file redirection");
+ menuin[0] = 'q';
+ menuin[1] = '\0';
+ } else {
+ puts("Switched back to console from file redirection");
+ continue;
+ }
+ }
+
+ if (cmd_echo) {
+ printf("%s", menuin);
+ }
+
+ /* Update call setting */
+ pjsua_call_setting_default(&call_opt);
+ call_opt.aud_cnt = app_config.aud_cnt;
+ call_opt.vid_cnt = app_config.vid.vid_cnt;
+
+ switch (menuin[0]) {
+
+ case 'm':
+ /* Make call! : */
+ ui_make_new_call();
+ break;
+
+ case 'M':
+ /* Make multiple calls! : */
+ ui_make_multi_call();
+ break;
+
+ case 'n':
+ ui_detect_nat_type();
+ break;
+
+ case 'i':
+ /* Send instant messaeg */
+ ui_send_instant_message();
+ break;
+
+ case 'a':
+ ui_answer_call();
+ break;
+
+ case 'h':
+ ui_hangup_call(menuin);
+ break;
+
+ case ']':
+ case '[':
+ /*
+ * Cycle next/prev dialog.
+ */
+ ui_cycle_dialog(menuin);
+ break;
+
+ case '>':
+ case '<':
+ ui_cycle_account();
+ break;
+
+ case '+':
+ if (menuin[1] == 'b') {
+ ui_add_buddy();
+ } else if (menuin[1] == 'a') {
+ ui_add_account(&app_config.rtp_cfg);
+ } else {
+ printf("Invalid input %s\n", menuin);
+ }
+ break;
+
+ case '-':
+ if (menuin[1] == 'b') {
+ ui_delete_buddy();
+ } else if (menuin[1] == 'a') {
+ ui_delete_account();
+ } else {
+ printf("Invalid input %s\n", menuin);
+ }
+ break;
+
+ case 'H':
+ /*
+ * Hold call.
+ */
+ ui_call_hold();
+ break;
+
+ case 'v':
+#if PJSUA_HAS_VIDEO
+ if (menuin[1]=='i' && menuin[2]=='d' && menuin[3]==' ') {
+ vid_handle_menu(menuin);
+ } else
+#endif
+ if (current_call != -1) {
+ /*
+ * re-INVITE
+ */
+ ui_call_reinvite();
+ } else {
+ PJ_LOG(3,(THIS_FILE, "No current call"));
+ }
+ break;
+
+ case 'U':
+ /*
+ * Send UPDATE
+ */
+ ui_send_update();
+ break;
+
+ case 'C':
+ if (menuin[1] == 'p') {
+ ui_manage_codec_prio();
+ }
+ break;
+
+ case 'x':
+ /*
+ * Transfer call.
+ */
+ ui_call_transfer(app_config.no_refersub);
+ break;
+
+ case 'X':
+ /*
+ * Transfer call with replaces.
+ */
+ ui_call_transfer_replaces(app_config.no_refersub);
+ break;
+
+ case '#':
+ /*
+ * Send DTMF strings.
+ */
+ ui_send_dtmf_2833();
+ break;
+
+ case '*':
+ /* Send DTMF with INFO */
+ ui_send_dtmf_info();
+ break;
+
+ case 'S':
+ /*
+ * Send arbitrary request
+ */
+ ui_send_arbitrary_request();
+ break;
+
+ case 'e':
+ ui_echo(menuin);
+ break;
+
+ case 's':
+ if (pj_ansi_strnicmp(menuin, "sleep", 5)==0) {
+ ui_sleep(menuin);
+ break;
+ }
+ /* Continue below */
+
+ case 'u':
+ /*
+ * Subscribe/unsubscribe presence.
+ */
+ ui_subscribe(menuin);
+ break;
+
+ case 'r':
+ ui_register(menuin);
+ break;
+
+ case 't':
+ ui_toggle_state();
+ break;
+
+ case 'T':
+ ui_change_online_status();
+ break;
+
+ case 'c':
+ switch (menuin[1]) {
+ case 'l':
+ ui_conf_list();
+ break;
+ case 'c':
+ case 'd':
+ ui_conf_connect(menuin);
+ break;
+ }
+ break;
+
+ case 'V':
+ /* Adjust audio volume */
+ ui_adjust_volume();
+ break;
+
+ case 'd':
+ if (menuin[1] == 'c') {
+ ui_dump_configuration();
+ } else if (menuin[1] == 'q') {
+ ui_dump_call_quality();
+ } else {
+ ui_app_dump(menuin[1]=='d');
+ }
+ break;
+
+ case 'f':
+ if (simple_input("Enter output filename", buf, sizeof(buf))) {
+ ui_write_settings();
+ }
+ break;
+
+ case 'L': /* Restart */
+ case 'q':
+ legacy_on_stopped(menuin[0]=='L');
+ goto on_exit;
+
+ case 'R':
+ ui_call_redirect(menuin);
+ break;
+
+ default:
+ if (menuin[0] != '\n' && menuin[0] != '\r') {
+ printf("Invalid input %s", menuin);
+ }
+ keystroke_help();
+ break;
+ }
+ }
+
+on_exit:
+ ;
+}
diff --git a/jni/pjproject-android/.svn/pristine/9e/9ebd451dd171ea37bc25f9627195daeba7947a5c.svn-base b/jni/pjproject-android/.svn/pristine/9e/9ebd451dd171ea37bc25f9627195daeba7947a5c.svn-base
new file mode 100644
index 0000000..3d01d25
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/9e/9ebd451dd171ea37bc25f9627195daeba7947a5c.svn-base
@@ -0,0 +1,175 @@
+/*
+ * rand_source.c
+ *
+ * implements a random source based on /dev/random
+ *
+ * David A. McGrew
+ * Cisco Systems, Inc.
+ */
+/*
+ *
+ * Copyright(c) 2001-2006 Cisco Systems, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * Neither the name of the Cisco Systems, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include "srtp_config.h"
+
+#if defined(DEV_URANDOM) || defined(PJ_DEV_URANDOM)
+# include <fcntl.h> /* for open() */
+# include <unistd.h> /* for close() */
+#elif (_MSC_VER >= 1400)
+#define _CRT_RAND_S
+# include <stdlib.h>
+# include <stdio.h>
+#else
+# include <stdio.h>
+#endif
+
+#include "rand_source.h"
+
+
+/*
+ * global dev_rand_fdes is file descriptor for /dev/random
+ *
+ * This variable is also used to indicate that the random source has
+ * been initialized. When this variable is set to the value of the
+ * #define RAND_SOURCE_NOT_READY, it indicates that the random source
+ * is not ready to be used. The value of the #define
+ * RAND_SOURCE_READY is for use whenever that variable is used as an
+ * indicator of the state of the random source, but not as a file
+ * descriptor.
+ */
+
+#define RAND_SOURCE_NOT_READY (-1)
+#define RAND_SOURCE_READY (17)
+
+static int dev_random_fdes = RAND_SOURCE_NOT_READY;
+
+
+err_status_t
+rand_source_init(void) {
+ if (dev_random_fdes >= 0) {
+ /* already open */
+ return err_status_ok;
+ }
+#ifdef DEV_URANDOM
+ /* open random source for reading */
+ dev_random_fdes = open(DEV_URANDOM, O_RDONLY);
+ if (dev_random_fdes < 0)
+ return err_status_init_fail;
+#elif defined(PJ_DEV_URANDOM)
+ /* open random source for reading */
+ dev_random_fdes = open(PJ_DEV_URANDOM, O_RDONLY);
+ if (dev_random_fdes < 0) {
+ err_report(3,"Ugh: /dev/urandom not present, using rand() instead");
+ return err_status_ok; /* it's ok, it'll fallback to using rand() */
+ }
+#elif (_MSC_VER >= 1400)
+ dev_random_fdes = RAND_SOURCE_READY;
+#else
+ /* no random source available; let the user know */
+ err_report(err_level_info, "WARNING: no real random source present!\n");
+ dev_random_fdes = RAND_SOURCE_READY;
+#endif
+ return err_status_ok;
+}
+
+err_status_t
+rand_source_get_octet_string(void *dest, uint32_t len) {
+
+ /*
+ * read len octets from /dev/random to dest, and
+ * check return value to make sure enough octets were
+ * written
+ */
+#ifdef DEV_URANDOM
+ if (read(dev_random_fdes, dest, len) != len)
+ return err_status_fail;
+#elif 0 && (_MSC_VER >= 1400) /* disabled rand_s, causing assertion 'rand_s not supported' in vs8 */
+ unsigned int *dst = dest;
+ while (len)
+ {
+ unsigned int val = 0;
+ errno_t err = rand_s(&val);
+ if (err != 0)
+ {
+ return err_status_fail;
+ }
+
+ *dst++ = val;
+ len--;
+ }
+#else
+ uint8_t *dst = (uint8_t *)dest;
+
+#ifdef PJ_DEV_URANDOM
+ /* First try with /dev/urandom, if it's opened */
+ if (dev_random_fdes >= 0) {
+ if (read(dev_random_fdes, dest, len) == len)
+ return err_status_ok; /* success */
+ }
+#endif
+
+ /* Generic C-library (rand()) version */
+ /* This is a random source of last resort */
+ while (len)
+ {
+ int val = rand();
+ /* rand() returns 0-32767 (ugh) */
+ /* Is this a good enough way to get random bytes?
+ It is if it passes FIPS-140... */
+ *dst++ = val & 0xff;
+ len--;
+ }
+#endif
+ return err_status_ok;
+}
+
+err_status_t
+rand_source_deinit(void) {
+#ifndef PJ_DEV_URANDOM
+ if (dev_random_fdes < 0)
+ return err_status_dealloc_fail; /* well, we haven't really failed, *
+ * but there is something wrong */
+#endif
+
+#if defined(DEV_URANDOM) || defined(PJ_DEV_URANDOM)
+ if (dev_random_fdes >= 0)
+ close(dev_random_fdes);
+
+ dev_random_fdes = RAND_SOURCE_NOT_READY;
+#endif
+
+ return err_status_ok;
+}
+
diff --git a/jni/pjproject-android/.svn/pristine/9e/9ed8d42a967b3d3735c98c888add53a51bd50dcc.svn-base b/jni/pjproject-android/.svn/pristine/9e/9ed8d42a967b3d3735c98c888add53a51bd50dcc.svn-base
new file mode 100644
index 0000000..2dd9444
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/9e/9ed8d42a967b3d3735c98c888add53a51bd50dcc.svn-base
@@ -0,0 +1,572 @@
+/* $Id$ */
+/*
+ * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
+ * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include "test.h"
+#include <pjlib.h>
+#include <pj/compat/high_precision.h>
+
+/**
+ * \page page_pjlib_ioqueue_perf_test Test: I/O Queue Performance
+ *
+ * Test the performance of the I/O queue, using typical producer
+ * consumer test. The test should examine the effect of using multiple
+ * threads on the performance.
+ *
+ * This file is <b>pjlib-test/ioq_perf.c</b>
+ *
+ * \include pjlib-test/ioq_perf.c
+ */
+
+#if INCLUDE_IOQUEUE_PERF_TEST
+
+#ifdef _MSC_VER
+# pragma warning ( disable: 4204) // non-constant aggregate initializer
+#endif
+
+#define THIS_FILE "ioq_perf"
+//#define TRACE_(expr) PJ_LOG(3,expr)
+#define TRACE_(expr)
+
+
+static pj_bool_t thread_quit_flag;
+static pj_status_t last_error;
+static unsigned last_error_counter;
+
+/* Descriptor for each producer/consumer pair. */
+typedef struct test_item
+{
+ pj_sock_t server_fd,
+ client_fd;
+ pj_ioqueue_t *ioqueue;
+ pj_ioqueue_key_t *server_key,
+ *client_key;
+ pj_ioqueue_op_key_t recv_op,
+ send_op;
+ int has_pending_send;
+ pj_size_t buffer_size;
+ char *outgoing_buffer;
+ char *incoming_buffer;
+ pj_size_t bytes_sent,
+ bytes_recv;
+} test_item;
+
+/* Callback when data has been read.
+ * Increment item->bytes_recv and ready to read the next data.
+ */
+static void on_read_complete(pj_ioqueue_key_t *key,
+ pj_ioqueue_op_key_t *op_key,
+ pj_ssize_t bytes_read)
+{
+ test_item *item = (test_item*)pj_ioqueue_get_user_data(key);
+ pj_status_t rc;
+ int data_is_available = 1;
+
+ //TRACE_((THIS_FILE, " read complete, bytes_read=%d", bytes_read));
+
+ do {
+ if (thread_quit_flag)
+ return;
+
+ if (bytes_read < 0) {
+ pj_status_t rc = (pj_status_t)-bytes_read;
+ char errmsg[PJ_ERR_MSG_SIZE];
+
+ if (rc != last_error) {
+ //last_error = rc;
+ pj_strerror(rc, errmsg, sizeof(errmsg));
+ PJ_LOG(3,(THIS_FILE,"...error: read error, bytes_read=%d (%s)",
+ bytes_read, errmsg));
+ PJ_LOG(3,(THIS_FILE,
+ ".....additional info: total read=%u, total sent=%u",
+ item->bytes_recv, item->bytes_sent));
+ } else {
+ last_error_counter++;
+ }
+ bytes_read = 0;
+
+ } else if (bytes_read == 0) {
+ PJ_LOG(3,(THIS_FILE, "...socket has closed!"));
+ }
+
+ item->bytes_recv += bytes_read;
+
+ /* To assure that the test quits, even if main thread
+ * doesn't have time to run.
+ */
+ if (item->bytes_recv > item->buffer_size * 10000)
+ thread_quit_flag = 1;
+
+ bytes_read = item->buffer_size;
+ rc = pj_ioqueue_recv( key, op_key,
+ item->incoming_buffer, &bytes_read, 0 );
+
+ if (rc == PJ_SUCCESS) {
+ data_is_available = 1;
+ } else if (rc == PJ_EPENDING) {
+ data_is_available = 0;
+ } else {
+ data_is_available = 0;
+ if (rc != last_error) {
+ last_error = rc;
+ app_perror("...error: read error(1)", rc);
+ } else {
+ last_error_counter++;
+ }
+ }
+
+ if (!item->has_pending_send) {
+ pj_ssize_t sent = item->buffer_size;
+ rc = pj_ioqueue_send(item->client_key, &item->send_op,
+ item->outgoing_buffer, &sent, 0);
+ if (rc != PJ_SUCCESS && rc != PJ_EPENDING) {
+ app_perror("...error: write error", rc);
+ }
+
+ item->has_pending_send = (rc==PJ_EPENDING);
+ }
+
+ } while (data_is_available);
+}
+
+/* Callback when data has been written.
+ * Increment item->bytes_sent and write the next data.
+ */
+static void on_write_complete(pj_ioqueue_key_t *key,
+ pj_ioqueue_op_key_t *op_key,
+ pj_ssize_t bytes_sent)
+{
+ test_item *item = (test_item*) pj_ioqueue_get_user_data(key);
+
+ //TRACE_((THIS_FILE, " write complete: sent = %d", bytes_sent));
+
+ if (thread_quit_flag)
+ return;
+
+ item->has_pending_send = 0;
+ item->bytes_sent += bytes_sent;
+
+ if (bytes_sent <= 0) {
+ PJ_LOG(3,(THIS_FILE, "...error: sending stopped. bytes_sent=%d",
+ bytes_sent));
+ }
+ else {
+ pj_status_t rc;
+
+ bytes_sent = item->buffer_size;
+ rc = pj_ioqueue_send( item->client_key, op_key,
+ item->outgoing_buffer, &bytes_sent, 0);
+ if (rc != PJ_SUCCESS && rc != PJ_EPENDING) {
+ app_perror("...error: write error", rc);
+ }
+
+ item->has_pending_send = (rc==PJ_EPENDING);
+ }
+}
+
+struct thread_arg
+{
+ int id;
+ pj_ioqueue_t *ioqueue;
+ unsigned counter;
+};
+
+/* The worker thread. */
+static int worker_thread(void *p)
+{
+ struct thread_arg *arg = (struct thread_arg*) p;
+ const pj_time_val timeout = {0, 100};
+ int rc;
+
+ while (!thread_quit_flag) {
+
+ ++arg->counter;
+ rc = pj_ioqueue_poll(arg->ioqueue, &timeout);
+ //TRACE_((THIS_FILE, " thread: poll returned rc=%d", rc));
+ if (rc < 0) {
+ char errmsg[PJ_ERR_MSG_SIZE];
+ pj_strerror(-rc, errmsg, sizeof(errmsg));
+ PJ_LOG(3, (THIS_FILE,
+ "...error in pj_ioqueue_poll() in thread %d "
+ "after %d loop: %s [pj_status_t=%d]",
+ arg->id, arg->counter, errmsg, -rc));
+ //return -1;
+ }
+ }
+ return 0;
+}
+
+/* Calculate the bandwidth for the specific test configuration.
+ * The test is simple:
+ * - create sockpair_cnt number of producer-consumer socket pair.
+ * - create thread_cnt number of worker threads.
+ * - each producer will send buffer_size bytes data as fast and
+ * as soon as it can.
+ * - each consumer will read buffer_size bytes of data as fast
+ * as it could.
+ * - measure the total bytes received by all consumers during a
+ * period of time.
+ */
+static int perform_test(pj_bool_t allow_concur,
+ int sock_type, const char *type_name,
+ unsigned thread_cnt, unsigned sockpair_cnt,
+ pj_size_t buffer_size,
+ pj_size_t *p_bandwidth)
+{
+ enum { MSEC_DURATION = 5000 };
+ pj_pool_t *pool;
+ test_item *items;
+ pj_thread_t **thread;
+ pj_ioqueue_t *ioqueue;
+ pj_status_t rc;
+ pj_ioqueue_callback ioqueue_callback;
+ pj_uint32_t total_elapsed_usec, total_received;
+ pj_highprec_t bandwidth;
+ pj_timestamp start, stop;
+ unsigned i;
+
+ TRACE_((THIS_FILE, " starting test.."));
+
+ ioqueue_callback.on_read_complete = &on_read_complete;
+ ioqueue_callback.on_write_complete = &on_write_complete;
+
+ thread_quit_flag = 0;
+
+ pool = pj_pool_create(mem, NULL, 4096, 4096, NULL);
+ if (!pool)
+ return -10;
+
+ items = (test_item*) pj_pool_alloc(pool, sockpair_cnt*sizeof(test_item));
+ thread = (pj_thread_t**)
+ pj_pool_alloc(pool, thread_cnt*sizeof(pj_thread_t*));
+
+ TRACE_((THIS_FILE, " creating ioqueue.."));
+ rc = pj_ioqueue_create(pool, sockpair_cnt*2, &ioqueue);
+ if (rc != PJ_SUCCESS) {
+ app_perror("...error: unable to create ioqueue", rc);
+ return -15;
+ }
+
+ rc = pj_ioqueue_set_default_concurrency(ioqueue, allow_concur);
+ if (rc != PJ_SUCCESS) {
+ app_perror("...error: pj_ioqueue_set_default_concurrency()", rc);
+ return -16;
+ }
+
+ /* Initialize each producer-consumer pair. */
+ for (i=0; i<sockpair_cnt; ++i) {
+ pj_ssize_t bytes;
+
+ items[i].ioqueue = ioqueue;
+ items[i].buffer_size = buffer_size;
+ items[i].outgoing_buffer = (char*) pj_pool_alloc(pool, buffer_size);
+ items[i].incoming_buffer = (char*) pj_pool_alloc(pool, buffer_size);
+ items[i].bytes_recv = items[i].bytes_sent = 0;
+
+ /* randomize outgoing buffer. */
+ pj_create_random_string(items[i].outgoing_buffer, buffer_size);
+
+ /* Create socket pair. */
+ TRACE_((THIS_FILE, " calling socketpair.."));
+ rc = app_socketpair(pj_AF_INET(), sock_type, 0,
+ &items[i].server_fd, &items[i].client_fd);
+ if (rc != PJ_SUCCESS) {
+ app_perror("...error: unable to create socket pair", rc);
+ return -20;
+ }
+
+ /* Register server socket to ioqueue. */
+ TRACE_((THIS_FILE, " register(1).."));
+ rc = pj_ioqueue_register_sock(pool, ioqueue,
+ items[i].server_fd,
+ &items[i], &ioqueue_callback,
+ &items[i].server_key);
+ if (rc != PJ_SUCCESS) {
+ app_perror("...error: registering server socket to ioqueue", rc);
+ return -60;
+ }
+
+ /* Register client socket to ioqueue. */
+ TRACE_((THIS_FILE, " register(2).."));
+ rc = pj_ioqueue_register_sock(pool, ioqueue,
+ items[i].client_fd,
+ &items[i], &ioqueue_callback,
+ &items[i].client_key);
+ if (rc != PJ_SUCCESS) {
+ app_perror("...error: registering server socket to ioqueue", rc);
+ return -70;
+ }
+
+ /* Start reading. */
+ TRACE_((THIS_FILE, " pj_ioqueue_recv.."));
+ bytes = items[i].buffer_size;
+ rc = pj_ioqueue_recv(items[i].server_key, &items[i].recv_op,
+ items[i].incoming_buffer, &bytes,
+ 0);
+ if (rc != PJ_EPENDING) {
+ app_perror("...error: pj_ioqueue_recv", rc);
+ return -73;
+ }
+
+ /* Start writing. */
+ TRACE_((THIS_FILE, " pj_ioqueue_write.."));
+ bytes = items[i].buffer_size;
+ rc = pj_ioqueue_send(items[i].client_key, &items[i].send_op,
+ items[i].outgoing_buffer, &bytes, 0);
+ if (rc != PJ_SUCCESS && rc != PJ_EPENDING) {
+ app_perror("...error: pj_ioqueue_write", rc);
+ return -76;
+ }
+
+ items[i].has_pending_send = (rc==PJ_EPENDING);
+ }
+
+ /* Create the threads. */
+ for (i=0; i<thread_cnt; ++i) {
+ struct thread_arg *arg;
+
+ arg = (struct thread_arg*) pj_pool_zalloc(pool, sizeof(*arg));
+ arg->id = i;
+ arg->ioqueue = ioqueue;
+ arg->counter = 0;
+
+ rc = pj_thread_create( pool, NULL,
+ &worker_thread,
+ arg,
+ PJ_THREAD_DEFAULT_STACK_SIZE,
+ PJ_THREAD_SUSPENDED, &thread[i] );
+ if (rc != PJ_SUCCESS) {
+ app_perror("...error: unable to create thread", rc);
+ return -80;
+ }
+ }
+
+ /* Mark start time. */
+ rc = pj_get_timestamp(&start);
+ if (rc != PJ_SUCCESS)
+ return -90;
+
+ /* Start the thread. */
+ TRACE_((THIS_FILE, " resuming all threads.."));
+ for (i=0; i<thread_cnt; ++i) {
+ rc = pj_thread_resume(thread[i]);
+ if (rc != 0)
+ return -100;
+ }
+
+ /* Wait for MSEC_DURATION seconds.
+ * This should be as simple as pj_thread_sleep(MSEC_DURATION) actually,
+ * but unfortunately it doesn't work when system doesn't employ
+ * timeslicing for threads.
+ */
+ TRACE_((THIS_FILE, " wait for few seconds.."));
+ do {
+ pj_thread_sleep(1);
+
+ /* Mark end time. */
+ rc = pj_get_timestamp(&stop);
+
+ if (thread_quit_flag) {
+ TRACE_((THIS_FILE, " transfer limit reached.."));
+ break;
+ }
+
+ if (pj_elapsed_usec(&start,&stop)<MSEC_DURATION * 1000) {
+ TRACE_((THIS_FILE, " time limit reached.."));
+ break;
+ }
+
+ } while (1);
+
+ /* Terminate all threads. */
+ TRACE_((THIS_FILE, " terminating all threads.."));
+ thread_quit_flag = 1;
+
+ for (i=0; i<thread_cnt; ++i) {
+ TRACE_((THIS_FILE, " join thread %d..", i));
+ pj_thread_join(thread[i]);
+ }
+
+ /* Close all sockets. */
+ TRACE_((THIS_FILE, " closing all sockets.."));
+ for (i=0; i<sockpair_cnt; ++i) {
+ pj_ioqueue_unregister(items[i].server_key);
+ pj_ioqueue_unregister(items[i].client_key);
+ }
+
+ /* Destroy threads */
+ for (i=0; i<thread_cnt; ++i) {
+ pj_thread_destroy(thread[i]);
+ }
+
+ /* Destroy ioqueue. */
+ TRACE_((THIS_FILE, " destroying ioqueue.."));
+ pj_ioqueue_destroy(ioqueue);
+
+ /* Calculate actual time in usec. */
+ total_elapsed_usec = pj_elapsed_usec(&start, &stop);
+
+ /* Calculate total bytes received. */
+ total_received = 0;
+ for (i=0; i<sockpair_cnt; ++i) {
+ total_received = (pj_uint32_t)items[i].bytes_recv;
+ }
+
+ /* bandwidth = total_received*1000/total_elapsed_usec */
+ bandwidth = total_received;
+ pj_highprec_mul(bandwidth, 1000);
+ pj_highprec_div(bandwidth, total_elapsed_usec);
+
+ *p_bandwidth = (pj_uint32_t)bandwidth;
+
+ PJ_LOG(3,(THIS_FILE, " %.4s %2d %2d %8d KB/s",
+ type_name, thread_cnt, sockpair_cnt,
+ *p_bandwidth));
+
+ /* Done. */
+ pj_pool_release(pool);
+
+ TRACE_((THIS_FILE, " done.."));
+ return 0;
+}
+
+static int ioqueue_perf_test_imp(pj_bool_t allow_concur)
+{
+ enum { BUF_SIZE = 512 };
+ int i, rc;
+ struct {
+ int type;
+ const char *type_name;
+ int thread_cnt;
+ int sockpair_cnt;
+ } test_param[] =
+ {
+ { pj_SOCK_DGRAM(), "udp", 1, 1},
+ { pj_SOCK_DGRAM(), "udp", 1, 2},
+ { pj_SOCK_DGRAM(), "udp", 1, 4},
+ { pj_SOCK_DGRAM(), "udp", 1, 8},
+ { pj_SOCK_DGRAM(), "udp", 2, 1},
+ { pj_SOCK_DGRAM(), "udp", 2, 2},
+ { pj_SOCK_DGRAM(), "udp", 2, 4},
+ { pj_SOCK_DGRAM(), "udp", 2, 8},
+ { pj_SOCK_DGRAM(), "udp", 4, 1},
+ { pj_SOCK_DGRAM(), "udp", 4, 2},
+ { pj_SOCK_DGRAM(), "udp", 4, 4},
+ { pj_SOCK_DGRAM(), "udp", 4, 8},
+ { pj_SOCK_DGRAM(), "udp", 4, 16},
+ { pj_SOCK_STREAM(), "tcp", 1, 1},
+ { pj_SOCK_STREAM(), "tcp", 1, 2},
+ { pj_SOCK_STREAM(), "tcp", 1, 4},
+ { pj_SOCK_STREAM(), "tcp", 1, 8},
+ { pj_SOCK_STREAM(), "tcp", 2, 1},
+ { pj_SOCK_STREAM(), "tcp", 2, 2},
+ { pj_SOCK_STREAM(), "tcp", 2, 4},
+ { pj_SOCK_STREAM(), "tcp", 2, 8},
+ { pj_SOCK_STREAM(), "tcp", 4, 1},
+ { pj_SOCK_STREAM(), "tcp", 4, 2},
+ { pj_SOCK_STREAM(), "tcp", 4, 4},
+ { pj_SOCK_STREAM(), "tcp", 4, 8},
+ { pj_SOCK_STREAM(), "tcp", 4, 16},
+/*
+ { pj_SOCK_DGRAM(), "udp", 32, 1},
+ { pj_SOCK_DGRAM(), "udp", 32, 1},
+ { pj_SOCK_DGRAM(), "udp", 32, 1},
+ { pj_SOCK_DGRAM(), "udp", 32, 1},
+ { pj_SOCK_DGRAM(), "udp", 1, 32},
+ { pj_SOCK_DGRAM(), "udp", 1, 32},
+ { pj_SOCK_DGRAM(), "udp", 1, 32},
+ { pj_SOCK_DGRAM(), "udp", 1, 32},
+ { pj_SOCK_STREAM(), "tcp", 32, 1},
+ { pj_SOCK_STREAM(), "tcp", 32, 1},
+ { pj_SOCK_STREAM(), "tcp", 32, 1},
+ { pj_SOCK_STREAM(), "tcp", 32, 1},
+ { pj_SOCK_STREAM(), "tcp", 1, 32},
+ { pj_SOCK_STREAM(), "tcp", 1, 32},
+ { pj_SOCK_STREAM(), "tcp", 1, 32},
+ { pj_SOCK_STREAM(), "tcp", 1, 32},
+*/
+ };
+ pj_size_t best_bandwidth;
+ int best_index = 0;
+
+ PJ_LOG(3,(THIS_FILE, " Benchmarking %s ioqueue:", pj_ioqueue_name()));
+ PJ_LOG(3,(THIS_FILE, " Testing with concurency=%d", allow_concur));
+ PJ_LOG(3,(THIS_FILE, " ======================================="));
+ PJ_LOG(3,(THIS_FILE, " Type Threads Skt.Pairs Bandwidth"));
+ PJ_LOG(3,(THIS_FILE, " ======================================="));
+
+ best_bandwidth = 0;
+ for (i=0; i<(int)(sizeof(test_param)/sizeof(test_param[0])); ++i) {
+ pj_size_t bandwidth;
+
+ rc = perform_test(allow_concur,
+ test_param[i].type,
+ test_param[i].type_name,
+ test_param[i].thread_cnt,
+ test_param[i].sockpair_cnt,
+ BUF_SIZE,
+ &bandwidth);
+ if (rc != 0)
+ return rc;
+
+ if (bandwidth > best_bandwidth)
+ best_bandwidth = bandwidth, best_index = i;
+
+ /* Give it a rest before next test, to allow system to close the
+ * sockets properly.
+ */
+ pj_thread_sleep(500);
+ }
+
+ PJ_LOG(3,(THIS_FILE,
+ " Best: Type=%s Threads=%d, Skt.Pairs=%d, Bandwidth=%u KB/s",
+ test_param[best_index].type_name,
+ test_param[best_index].thread_cnt,
+ test_param[best_index].sockpair_cnt,
+ best_bandwidth));
+ PJ_LOG(3,(THIS_FILE, " (Note: packet size=%d, total errors=%u)",
+ BUF_SIZE, last_error_counter));
+ return 0;
+}
+
+/*
+ * main test entry.
+ */
+int ioqueue_perf_test(void)
+{
+ int rc;
+
+ rc = ioqueue_perf_test_imp(PJ_TRUE);
+ if (rc != 0)
+ return rc;
+
+ rc = ioqueue_perf_test_imp(PJ_FALSE);
+ if (rc != 0)
+ return rc;
+
+ return 0;
+}
+
+#else
+/* To prevent warning about "translation unit is empty"
+ * when this test is disabled.
+ */
+int dummy_uiq_perf_test;
+#endif /* INCLUDE_IOQUEUE_PERF_TEST */
+
+
diff --git a/jni/pjproject-android/.svn/pristine/9e/9eda21bc212542b0384326e0bb3b3aeb31644658.svn-base b/jni/pjproject-android/.svn/pristine/9e/9eda21bc212542b0384326e0bb3b3aeb31644658.svn-base
new file mode 100644
index 0000000..d9f6779
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/9e/9eda21bc212542b0384326e0bb3b3aeb31644658.svn-base
@@ -0,0 +1,142 @@
+/* $Id$ */
+/*
+ * Copyright (C) 2011 Teluu Inc. (http://www.teluu.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#ifndef __PJMEDIA_VID_TEE_H__
+#define __PJMEDIA_VID_TEE_H__
+
+/**
+ * @file vid_tee.h
+ * @brief Video tee (source duplicator).
+ */
+#include <pjmedia/port.h>
+
+/**
+ * @addtogroup PJMEDIA_VID_TEE Video source duplicator
+ * @ingroup PJMEDIA_PORT
+ * @brief Duplicate video data from a media port into multiple media port
+ * destinations
+ * @{
+ *
+ * This section describes media port to duplicate video data in the stream.
+ *
+ * A video tee branches video stream flow from one source port to multiple
+ * destination ports by simply duplicating the video data supplied by the
+ * source port and delivering the copy to all registered destinations.
+ *
+ * The video tee is a unidirectional port, i.e: data flows from source port
+ * to destination ports only. Also, the video source port MUST actively call
+ * pjmedia_port_put_frame() to the video tee and the video destination ports
+ * MUST NEVER call pjmedia_port_get_frame() to the video tee. Please note that
+ * there is no specific order of which destination port will receive a frame
+ * from the video tee.
+ *
+ * The video tee is not thread-safe, so it is application responsibility
+ * to synchronize video tee operations, e.g: make sure the source port is
+ * paused during adding or removing a destination port.
+ */
+
+PJ_BEGIN_DECL
+
+
+/**
+ * Enumeration of video tee flags.
+ */
+typedef enum pjmedia_vid_tee_flag
+{
+ /**
+ * Tell the video tee that the destination port will do in-place
+ * processing, so the delivered data may be modified by this port.
+ * If this flag is used, buffer will be copied before being given to
+ * the destination port.
+ */
+ PJMEDIA_VID_TEE_DST_DO_IN_PLACE_PROC = 4,
+
+} pjmedia_vid_tee_flag;
+
+
+/**
+ * Create a video tee port with the specified source media port. Application
+ * should destroy the tee with pjmedia_port_destroy() as usual. Note that
+ * destroying the tee does not destroy its destination ports.
+ *
+ * @param pool The pool.
+ * @param fmt The source media port's format.
+ * @param max_dst_cnt The maximum number of destination ports supported.
+ * @param p_vid_tee Pointer to receive the video tee port.
+ *
+ * @return PJ_SUCCESS on success, or the appropriate
+ * error code.
+ */
+PJ_DECL(pj_status_t) pjmedia_vid_tee_create(pj_pool_t *pool,
+ const pjmedia_format *fmt,
+ unsigned max_dst_cnt,
+ pjmedia_port **p_vid_tee);
+
+/**
+ * Add a destination media port to the video tee. For this function, the
+ * destination port's media format must match the source format.
+ *
+ * @param vid_tee The video tee.
+ * @param option Video tee option, see @pjmedia_vid_tee_flag.
+ * @param port The destination media port.
+ *
+ * @return PJ_SUCCESS on success, or the appropriate error
+ * code.
+ */
+PJ_DECL(pj_status_t) pjmedia_vid_tee_add_dst_port(pjmedia_port *vid_tee,
+ unsigned option,
+ pjmedia_port *port);
+
+
+/**
+ * Add a destination media port to the video tee. This function will also
+ * create a converter if the destination port's media format does not match
+ * the source format.
+ *
+ * @param vid_tee The video tee.
+ * @param option Video tee option, see @pjmedia_vid_tee_flag.
+ * @param port The destination media port.
+ *
+ * @return PJ_SUCCESS on success, or the appropriate error
+ * code.
+ */
+PJ_DECL(pj_status_t) pjmedia_vid_tee_add_dst_port2(pjmedia_port *vid_tee,
+ unsigned option,
+ pjmedia_port *port);
+
+
+/**
+ * Remove a destination media port from the video tee.
+ *
+ * @param vid_tee The video tee.
+ * @param port The destination media port to be removed.
+ *
+ * @return PJ_SUCCESS on success, or the appropriate error
+ * code.
+ */
+PJ_DECL(pj_status_t) pjmedia_vid_tee_remove_dst_port(pjmedia_port *vid_tee,
+ pjmedia_port *port);
+
+
+PJ_END_DECL
+
+/**
+ * @}
+ */
+
+#endif /* __PJMEDIA_VID_TEE_H__ */
diff --git a/jni/pjproject-android/.svn/pristine/9e/9edc14025f401352bab3d2b03842beecb12cf2c8.svn-base b/jni/pjproject-android/.svn/pristine/9e/9edc14025f401352bab3d2b03842beecb12cf2c8.svn-base
new file mode 100644
index 0000000..66dae9b
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/9e/9edc14025f401352bab3d2b03842beecb12cf2c8.svn-base
@@ -0,0 +1,284 @@
+/*-------------------------------------------------------------------
+ * Example algorithms f1, f1*, f2, f3, f4, f5, f5*
+ *-------------------------------------------------------------------
+ *
+ * A sample implementation of the example 3GPP authentication and
+ * key agreement functions f1, f1*, f2, f3, f4, f5 and f5*. This is
+ * a byte-oriented implementation of the functions, and of the block
+ * cipher kernel function Rijndael.
+ *
+ * This has been coded for clarity, not necessarily for efficiency.
+ *
+ * The functions f2, f3, f4 and f5 share the same inputs and have
+ * been coded together as a single function. f1, f1* and f5* are
+ * all coded separately.
+ *
+ *-----------------------------------------------------------------*/
+
+#include "milenage.h"
+#include "rijndael.h"
+
+/*--------------------------- prototypes --------------------------*/
+
+
+
+/*-------------------------------------------------------------------
+ * Algorithm f1
+ *-------------------------------------------------------------------
+ *
+ * Computes network authentication code MAC-A from key K, random
+ * challenge RAND, sequence number SQN and authentication management
+ * field AMF.
+ *
+ *-----------------------------------------------------------------*/
+
+void f1 ( u8 k[16], u8 rand[16], u8 sqn[6], u8 amf[2],
+ u8 mac_a[8], u8 op[16] )
+{
+ u8 op_c[16];
+ u8 temp[16];
+ u8 in1[16];
+ u8 out1[16];
+ u8 rijndaelInput[16];
+ u8 i;
+
+ RijndaelKeySchedule( k );
+
+ ComputeOPc( op_c, op );
+
+ for (i=0; i<16; i++)
+ rijndaelInput[i] = rand[i] ^ op_c[i];
+ RijndaelEncrypt( rijndaelInput, temp );
+
+ for (i=0; i<6; i++)
+ {
+ in1[i] = sqn[i];
+ in1[i+8] = sqn[i];
+ }
+ for (i=0; i<2; i++)
+ {
+ in1[i+6] = amf[i];
+ in1[i+14] = amf[i];
+ }
+
+ /* XOR op_c and in1, rotate by r1=64, and XOR *
+ * on the constant c1 (which is all zeroes) */
+
+ for (i=0; i<16; i++)
+ rijndaelInput[(i+8) % 16] = in1[i] ^ op_c[i];
+
+ /* XOR on the value temp computed before */
+
+ for (i=0; i<16; i++)
+ rijndaelInput[i] ^= temp[i];
+
+ RijndaelEncrypt( rijndaelInput, out1 );
+ for (i=0; i<16; i++)
+ out1[i] ^= op_c[i];
+
+ for (i=0; i<8; i++)
+ mac_a[i] = out1[i];
+
+ return;
+} /* end of function f1 */
+
+
+
+/*-------------------------------------------------------------------
+ * Algorithms f2-f5
+ *-------------------------------------------------------------------
+ *
+ * Takes key K and random challenge RAND, and returns response RES,
+ * confidentiality key CK, integrity key IK and anonymity key AK.
+ *
+ *-----------------------------------------------------------------*/
+
+void f2345 ( u8 k[16], u8 rand[16],
+ u8 res[8], u8 ck[16], u8 ik[16], u8 ak[6], u8 op[16] )
+{
+ u8 op_c[16];
+ u8 temp[16];
+ u8 out[16];
+ u8 rijndaelInput[16];
+ u8 i;
+
+ RijndaelKeySchedule( k );
+
+ ComputeOPc( op_c, op );
+
+ for (i=0; i<16; i++)
+ rijndaelInput[i] = rand[i] ^ op_c[i];
+ RijndaelEncrypt( rijndaelInput, temp );
+
+ /* To obtain output block OUT2: XOR OPc and TEMP, *
+ * rotate by r2=0, and XOR on the constant c2 (which *
+ * is all zeroes except that the last bit is 1). */
+
+ for (i=0; i<16; i++)
+ rijndaelInput[i] = temp[i] ^ op_c[i];
+ rijndaelInput[15] ^= 1;
+
+ RijndaelEncrypt( rijndaelInput, out );
+ for (i=0; i<16; i++)
+ out[i] ^= op_c[i];
+
+ for (i=0; i<8; i++)
+ res[i] = out[i+8];
+ for (i=0; i<6; i++)
+ ak[i] = out[i];
+
+ /* To obtain output block OUT3: XOR OPc and TEMP, *
+ * rotate by r3=32, and XOR on the constant c3 (which *
+ * is all zeroes except that the next to last bit is 1). */
+
+ for (i=0; i<16; i++)
+ rijndaelInput[(i+12) % 16] = temp[i] ^ op_c[i];
+ rijndaelInput[15] ^= 2;
+
+ RijndaelEncrypt( rijndaelInput, out );
+ for (i=0; i<16; i++)
+ out[i] ^= op_c[i];
+
+ for (i=0; i<16; i++)
+ ck[i] = out[i];
+
+ /* To obtain output block OUT4: XOR OPc and TEMP, *
+ * rotate by r4=64, and XOR on the constant c4 (which *
+ * is all zeroes except that the 2nd from last bit is 1). */
+
+ for (i=0; i<16; i++)
+ rijndaelInput[(i+8) % 16] = temp[i] ^ op_c[i];
+ rijndaelInput[15] ^= 4;
+
+ RijndaelEncrypt( rijndaelInput, out );
+ for (i=0; i<16; i++)
+ out[i] ^= op_c[i];
+
+ for (i=0; i<16; i++)
+ ik[i] = out[i];
+
+ return;
+} /* end of function f2345 */
+
+
+/*-------------------------------------------------------------------
+ * Algorithm f1*
+ *-------------------------------------------------------------------
+ *
+ * Computes resynch authentication code MAC-S from key K, random
+ * challenge RAND, sequence number SQN and authentication management
+ * field AMF.
+ *
+ *-----------------------------------------------------------------*/
+
+void f1star( u8 k[16], u8 rand[16], u8 sqn[6], u8 amf[2],
+ u8 mac_s[8], u8 op[16] )
+{
+ u8 op_c[16];
+ u8 temp[16];
+ u8 in1[16];
+ u8 out1[16];
+ u8 rijndaelInput[16];
+ u8 i;
+
+ RijndaelKeySchedule( k );
+
+ ComputeOPc( op_c, op );
+
+ for (i=0; i<16; i++)
+ rijndaelInput[i] = rand[i] ^ op_c[i];
+ RijndaelEncrypt( rijndaelInput, temp );
+
+ for (i=0; i<6; i++)
+ {
+ in1[i] = sqn[i];
+ in1[i+8] = sqn[i];
+ }
+ for (i=0; i<2; i++)
+ {
+ in1[i+6] = amf[i];
+ in1[i+14] = amf[i];
+ }
+
+ /* XOR op_c and in1, rotate by r1=64, and XOR *
+ * on the constant c1 (which is all zeroes) */
+
+ for (i=0; i<16; i++)
+ rijndaelInput[(i+8) % 16] = in1[i] ^ op_c[i];
+
+ /* XOR on the value temp computed before */
+
+ for (i=0; i<16; i++)
+ rijndaelInput[i] ^= temp[i];
+
+ RijndaelEncrypt( rijndaelInput, out1 );
+ for (i=0; i<16; i++)
+ out1[i] ^= op_c[i];
+
+ for (i=0; i<8; i++)
+ mac_s[i] = out1[i+8];
+
+ return;
+} /* end of function f1star */
+
+
+/*-------------------------------------------------------------------
+ * Algorithm f5*
+ *-------------------------------------------------------------------
+ *
+ * Takes key K and random challenge RAND, and returns resynch
+ * anonymity key AK.
+ *
+ *-----------------------------------------------------------------*/
+
+void f5star( u8 k[16], u8 rand[16],
+ u8 ak[6], u8 op[16] )
+{
+ u8 op_c[16];
+ u8 temp[16];
+ u8 out[16];
+ u8 rijndaelInput[16];
+ u8 i;
+
+ RijndaelKeySchedule( k );
+
+ ComputeOPc( op_c, op );
+
+ for (i=0; i<16; i++)
+ rijndaelInput[i] = rand[i] ^ op_c[i];
+ RijndaelEncrypt( rijndaelInput, temp );
+
+ /* To obtain output block OUT5: XOR OPc and TEMP, *
+ * rotate by r5=96, and XOR on the constant c5 (which *
+ * is all zeroes except that the 3rd from last bit is 1). */
+
+ for (i=0; i<16; i++)
+ rijndaelInput[(i+4) % 16] = temp[i] ^ op_c[i];
+ rijndaelInput[15] ^= 8;
+
+ RijndaelEncrypt( rijndaelInput, out );
+ for (i=0; i<16; i++)
+ out[i] ^= op_c[i];
+
+ for (i=0; i<6; i++)
+ ak[i] = out[i];
+
+ return;
+} /* end of function f5star */
+
+
+/*-------------------------------------------------------------------
+ * Function to compute OPc from OP and K. Assumes key schedule has
+ already been performed.
+ *-----------------------------------------------------------------*/
+
+void ComputeOPc( u8 op_c[16], u8 op[16] )
+{
+ u8 i;
+
+ RijndaelEncrypt( op, op_c );
+ for (i=0; i<16; i++)
+ op_c[i] ^= op[i];
+
+ return;
+} /* end of function ComputeOPc */
diff --git a/jni/pjproject-android/.svn/pristine/9e/9ee3f57e7e1153c6685590db6bc1a5a83f0b63d8.svn-base b/jni/pjproject-android/.svn/pristine/9e/9ee3f57e7e1153c6685590db6bc1a5a83f0b63d8.svn-base
new file mode 100644
index 0000000..c48d6c1
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/9e/9ee3f57e7e1153c6685590db6bc1a5a83f0b63d8.svn-base
@@ -0,0 +1,11 @@
+/*
+========================================================================
+ Name : pjsua.loc
+ Author : nanang
+ Copyright : Copyright (C) 2013 Teluu Inc. (http://www.teluu.com)
+ Description :
+========================================================================
+*/
+#ifdef LANGUAGE_01
+#include "pjsua.l01"
+#endif